Installing qt/pyqt commercial under windows XP with MinGW
The problem
Currently, there are no binaries for py-qt commercial version because of the many different ways that Qt can be built. This tutorial will try to explain how to compile and install QT/QScintilla/Sip/Pyqt using the GPL MinGW tools. Note that this is not the only way to install it, you may prefer using the M$ compiler, which is faster.
Pre requisites
Of course you will need a python version (mine is 2.3.3), also make sure that you don't have a compiler like Borland or M$ in your PATH environnement variable.
For the installation, you'll need:
MinGW, mingw32-make and the win-32 api, all available on MinGW website
- The QT win installer and the archives of py-qt, sip and qscintilla, all available when you buy py-qt.
- Of course you'll need a valid licence of qt and pyqt
Tweaking python dll
As explained here, you need to tweak the python dll.
Here's what you need to do:
Download pexports
- Unzip the archive somewhere, open a command prompt and cd to the extracted directory
- and just run (change the paths/names according to your python install):
pexports c:\Windows\System32\python23.dll > python23.def dlltool --dllname python23.dll --def python23.def --output-lib libpython23.a copy libpython23.a c:\python23\libs\
Installing MinGW
You need to install MinGW, mingw32-make and the win32-api files.
- install MinGW (i choose the binary "MinGW-3.1.0-1.exe")
- install mingw32-make (i choose the binary "mingw32-make-3.80.0-3.exe")
- Modify your PATH environment variable and add: C:\mingw\bin (paths are separated with ";")
- and finally untar the w32api (i choose w32api-2.5.tar.gz), and copy the lib and include directories on your MinGW install dir (c:/MinGW for me)
Installing QT
First, read the docs provided. Here's what I have done:
- Launched the qt-win-commercial-3.3.2.exe installer
- On the options screen i chose MinGW32 as compiler and unchecked the build examples options (because it takes much time to compile)
- On the Configuration screen, tab "Advanced" i checked the styles/WindowsXP/plugin radio button.
- the compile step is _really_ slow, so be patient.
Installing sip
First, read the docs provided. Here's the procedure:
- Unzip the sip archive somewhere, open a command prompt and cd to the extracted directory
- Run the following commands: (if you have message telling that make is not a valid command, try "mingw32-make" instead)
c:\python23\python configure.py -p win32-g++ make make install
Installing QScintilla
First, read the docs provided. Here's the procedure:
- Unzip the QScintilla archive somewhere, open a command prompt and cd to the extracted directory
- Run the following commands: (if you have message telling that make is not a valid command, try "mingw32-make" instead)
c:\python23\python configure.py make make install
Installing PyQT
First, read the docs provided. Here's the procedure:
- Unzip the PyQT archive somewhere, open a command prompt and cd to the extracted directory
- Be sure to copy the provided licence to the sip directory
- Run the following commands: (if you have message telling that make is not a valid command, try "mingw32-make" instead)
c:\python23\python configure.py make make install
Testing
Ok, that should be ok. Here's a test script (from the PyQT tutorial 1):
import sys
import qt
a = qt.QApplication(sys.argv)
hello = qt.QPushButton("Hello world!", None)
hello.resize(100, 30)
a.setMainWidget(hello)
hello.show()
sys.exit(a.exec_loop())If the script runs OK your done !
PyQt Wiki