– Make sure you don’t have cygwin or C:devkitPromsysbin in your path,
or else your make files can end up trying to run the Makefile using ‘sh’ and all
the makefile we’re about to use are meant to run from the windows command line.
If for some odd reason you type ‘sh’ on your windows command line and you see something like:
You’re likely to find this later on:
/bin/sh: -c: line 2: syntax error: unexpected end of file
– Install Qt open source, with the exe installer, this will attempt to install
ming if you don’t have it installed, say yes, mingw rocks.
– Make sure you have the following Windows environment variables set:
QTDIR = c:Qt4.2.2
QTMAKESPEC = win32-g++
– Make sure you have Python2.5, Qt bin and Mingw bin folders on your path
PATH = %PATH%;c:Mingwbin;c:Mingwlibexecgccmingw323.4.2;c:python25bin;c:Qt4.2.2bin
– Get pexports just in case the Qt doesn’t have libQtCore4.a on its lib/
You can download pexports at:
If you don’t have that libQtCore4.a you won’t be able to build PyQt.
So you’ll need to do this, go to your Qt bin folder, say:
And run this:
pexports QtCore4.dll > Qt4Core4.def
dlltool -dllname QtCore4.dll –def QtCore4.def –output-lib libQtCore4.a
Move the resulting file, libQtCore4.a, to c:Qt4.2.2lib
– PyQt needs “sip” to be able to bind the Qt libraries, sip will generate the necessary C++ code.
To install sip, get its source code, extract it to a folder say:
Once inside run it’s configure.py like this:
python configure.py -p win32-g++
That will create the Makefiles, then you will make it using
Now, I’m not sure what’s the environment variable of Mingw library path,
and I was having errors from the compilation of PyQt, telling me it couldn’t
find the sip libraries, so this is what I did:
– Copy all the .o files from c:sip-4.5.2siplib to c:mingwlib
– Copy all the .h files from c:sip-4.5.2siplib to c:mingwincludes
– Now it’s finally time to compile PyQt.
Uncompress the PyQt zip with the source (not the binary, if not we wouldn’t be doing this),
do it at the root of your hardrive (C:), you’ll end up with a folder named similar to this:
Go in there and do this:
mingw32-make (this will take a long time, it will wrap every Qt C++ library on a new .cpp file which will be then compiled to exist as a python binding)
If you have any errors write me a comment on this post
Awesome article! Helped a lot. Thanks!
Good work! Thanks a lot.
Big thanks for this article=)
but I one error =
Error: Failed to determine the layout of your Qt installation. Try again using
the –verbose flag to see more detail about the problem.