I’ve spent most of today at work compiling Qt and PyQt using Visual Studio.NET 2003. I finally got it all done, there are a few caveats like you have to edit your PATH and create shortcuts etc; but it’s nicer than the MinGW solution. I might have a go using VS2005 next 😉

The way I managed it (I couldn’t get it to work the way the PyKDE list said, downloading the MinGW distribution first etc.) was:

  1. Get the Qt 4.1.3 Windows GPL source here

  2. Get the all-important Q../Free patch here

  3. Get the SIP 4.4.5 Windows source here

  4. Get the PyQt 4.0 Windows GPL source here

  5. Extract the PyQt source to c:\qt\4.1.3

  6. Extract the patch to c:\qt\4.1.3 as well, then run installpatch41.bat

  7. Open up the VS.NET command prompt (not just the regular cmd.exe) and type the following:

set MAKE=nmake
set QMAKESPEC=win32-msvc.net
set QTDIR=C:\Qt\4.1.3
set PATH=%QTDIR%\bin;%QTDIR%\lib;%PATH%
cd c:\Qt\4.1.3
qconfigure.bat msvc.net -fast -release
  1. When that’s done, compile SIP and then PyQt4 (extract somewhere without spaces, e.g. c:\pyqt4-src and c:\sip-src):
python configure.py
nmake install
  1. Add c:\qt\4.1.3\bin to your PATH and create the QMAKESPEC=win32-msvc.net environment variable.

You will then find Designer, Assistant, uic etc. in the c:\qt\4.1.3 directory. I tested that Designer and pyuic4 works too.

The files/directories new to the a clean Python24 install are listed below, I’ve put these into a zip so I can just drop them on top of an exsiting Python24 directory to add PyQt:


Test your PyQt is working and Windows can find the DLL’s by typing the following into a Python prompt:

import sys
from PyQt4 import QtCore, QtGui

Update: I’ve just got IronPython running in Visual Studio 2005. It’s very beta-ish though, no Windows.Forms designer etc.