Compiling PyQt4 with VS.NET
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:
-
Get the Qt 4.1.3 Windows GPL source here
-
Get the all-important Q../Free patch here
-
Get the SIP 4.4.5 Windows source here
-
Get the PyQt 4.0 Windows GPL source here
-
Extract the PyQt source to c:\qt\4.1.3
-
Extract the patch to c:\qt\4.1.3 as well, then run installpatch41.bat
-
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
nmake
- 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
nmake install
- 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:
C:\Python24\pylupdate4.exe
C:\Python24\pyrcc4.exe
C:\Python24\pyuic4.bat
C:\Python24\sip
C:\Python24\Lib\site-packages\PyQt4
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.