This is a very old question, but if I came across this question with a decent answer a week ago, I would find it very useful. Here is what I did to achieve the desired result. As you noted, packages are not supported for PyQt5 and Python 2.7, so you have to create them yourself. Fortunately, the process is quite simple. By assumption, you already have Python 2.7 installed.
- You will need a valid installation of MS Visual C ++. I have a professional version, but I assume that the community version will work too.
- You will need the appropriate qt version. If you are using 32-bit Python, make sure you get 32-bit Qt. In addition, (although I think it doesnβt matter), I definitely got a version of Qt that was built with the same version of the MSVC compiler as mine. This can be important if there is any static connection between installing Qt and PyQt (which may lead to binary incompatibility of the associated object files.) Get Qt from http://download.qt.io/ Note that Qt has additional considerations about licensing, so you can take a look at https://www.qt.io/download/ first .
- Make sure the bin subdirectory of your Qt installation is in your system path.
- Get the source for SIP. SIP is available at riverbankcomputing.com. I used version 4.18.
There are three commands for creating and installing SIP. Do not run these commands from the standard shell; instead, use the Visual Studio tools command shell, so that your path includes the compiler, and so that the INCLUDE, LIBS, and LIBPATH environment variables are set.
python configure.py
If you are using a virtual environment for Python, you may need to modify the makefile for SIPLib, because it depends on the hard code dependencies on the location of the Python subdirectory and the libs subdirectory. I decided to point them to the Python install system (c: \ Python27 \ include and c: \ Python27 \ libs.) Now it will be as simple as
nmake
nmake install
The final part of this step is to verify that the sip.exe program was placed in a location that is part of your path (this can only be a problem if you are using the virtual Python environment. I copied the programs to the script directory.)
Get the source code for the version of PyQt that matches the version of Qt that you received earlier. It is available from the PyQt project at sourceforge, and the latest version is available at riverbankcomputing.com.
Repeat the same process:
python configure.py
nmake
nmake install
which you used to create SIP. In this case, the number of make files created is too large (all potentially with the wrong location of the python27.lib file and headers depending on your virtual environment.) I just copied the python27.lib file to the place where the make files are expected. Similarly, there are three applications that are installed in a location that is not part of the system path (pyuic5, pyrcc5 and pylupdate5), and I copied them to a location in the path.
Done. You should be able to create a PyQt5 / Python2.7 application.
Peter Du
source share