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.

  1. Unpack contents of SIP archive to some folder – preferably on the system disk (i.e. C:\)
  2. 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.
  3. 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 the your_platform placeholder 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.
  4. 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:

  1. Installed Python and Qt. Please note that if you use commercial version of Qt, you’ll have to buy commercial PyQt also.
  2. 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:

  1. Open cmd.exe in the same way as for the SIP.
  2. 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!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: