0
votes

I'm trying to get PyQt5 working with WinPython. PyQt5 comes with a readme file for installation, and I have unsuccessfully tried a few combinations of what I thought the first part of the readme tells me to do.

I have:

  • Windows 7 Home Premium 64-bit
  • WinPython-64bit-2.7.9.1
  • Qt 5.4
  • PyQt-gpl-5.4

PyQt-gpl-5.4 is in the folder (only partially sure that this is where I should have put it)

C:\WinPython-64bit-2.7.9.1\python-2.7.9.amd64\Lib\site-packages\PyQt-gpl-5.4

My current attempt at getting everything working is: I'm trying to run the configure.py file in PyQt-gpl-5.4, but when I do so I consistently get the following error:

Error: PyQt5 requires Qt v5.0 or later. You seem to be using v4.8.6.
Make sure the correct version of qmake is on your PATH.

What I think is the required version of qmake being referred to is in the folder

C:\Qt\5.4\mingw491_32\bin

However, I have no idea how to fix the error by adding the qmake in this folder to PATH. My most recent attempt was to add the folder using Spyder's Tools->PYTHONPATH manager, but this made no difference. I also tried adding it using sys.path.append('C:\Qt\5.4\mingw491_32\bin'), but this didn't work either. I have since removed the folder name from both of these locations.

How do I get PyQt5 working with WinPython-64bit-2.7.9.1, or I think equivalently, how to I get the configure.py file in the PyQt-gpl-5.4 folder to run?

Thanks.

1

1 Answers

0
votes

You definitely don't want the source code (i.e. PyQt-gpl-5.4) in the site-packages folder, because that's where the compiled modules will end up. Instead, it should just go in a temporary folder whilst you compile it.

When you run configure.py, you must take care to use the executable for the specific python that you are targeting. I do not know anything about WinPython, but for a normal python installation this means doing something like this:

    C:\Python34\python configure.py

As a first step, before attempting to actually compile anything, it would be advisable to take at look at all the configuration options that are available, like this:

    C:\Python34\python configure.py --help

(There's also the Installing PyQt5 section in the PyQt Docs).

This will tell you, for instance, that the simplest way to specify the Qt installation you are targeting would be something like this:

    C:\Python34\python configure.py --qmake C:\Qt\5.4\mingw491_32\bin\qmake

EDIT:

Sorry, that last part is wrong: the --qmake option isn't available on Windows, so you have to add the directory containing the qmake executable to your PATH. This can be done with the following command:

    set PATH=%PATH%;C:\Qt\5.4\mingw491_32\bin