Installing PyQt on Windows
July 3, 2009
In this post I’ll describe my experience during installation of PyQt on Windows platform. And I’ll post the mock-up which was promised in previous post in one of the following posts – I wasn’t yet able to find a decent and free tool for mock-ups creation.
So, to start you have to download and configure SIP -a tool for creation of C++ to Python bindings. This is essential to start work with PyQt.
- Unpack contents of SIP archive to some folder – preferably on the system disk (i.e. C:\)
- From the Start menu select the “Microsoft Visual Studio” -> “Visual Studio Tools” sub-item. Here run the “Visual Studio Command Prompt” with Administrator privileges (via right-click) – on Vista and Windows 7 SIP configuration script won’t be able to access system disk if it is not run with admin rights. If you use MinGW tools you can just start cmd.exe as Admin.
- In the opened command prompt go to SIP folder (in my case – C:\sip-4.8.1) and run the following command:
python configure.py -p [your_platform]
Replace theyour_platformplaceholder with real specification of the platform and compiler you use. For me it is: win32-msvc2005. The full list of supported platforms and compilers can be found at “\specs” folder. - Now just run “nmake” and, after SIP is built, “nmake install” (“make” – for MinGW).
At this moment SIP is installed as a package into your Python.
Before building and installing PyQt you have to ensure that you have the following prerequisites:
- Installed Python and Qt. Please note that if you use commercial version of Qt, you’ll have to buy commercial PyQt also.
- Qt environment is set correctly: QTDIR environment variable points to to folder with Qt, and PATH includes the folder containing qmake.exe.
Now you are ready to build PyQt:
- Open cmd.exe in the same way as for the SIP.
- run
python configure.py
nmake ("make" for MinGW)
nmake install ("make install" for MinGW)
At this moment we are ready to start development with PyQt!