I'm using Python 3.4 on Windows. When I run a script, it complains
ImportError: No Module named 'PyQt4'
So I tried to install it, but pip install PyQt4
gives
Could not find any downloads that satisfy the requirement PyQt4
although it does show up when I run pip search PyQt4
. I tried to pip install python-qt
, which installed successfully but that didn't solve the problem.
What am I doing wrong?
If you install PyQt4 on Windows, files wind up here by default:
but it also leaves a file here:
If you copy the both the sip.pyd and PyQt4 folder into your virtualenv things will work fine.
For example:
Then with windows explorer copy from
C:\Python27\Lib\site-packages
the file (sip.pyd) and folder (PyQt4) mentioned above toC:\code\BACKUP\Lib\site-packages\
Then back at CLI:
The problem with trying to launch a script which calls PyQt4 from within virtualenv is that the virtualenv does not have PyQt4 installed and it doesn't know how to reference the default installation described above. But follow these steps to copy PyQt4 into your virtualenv and things should work great.
Try this for PyQt5:
Use the operating system on this link for PyQt4.
Or download the supported wheel for your platform on this link.
Else use this link for the windows executable installer. Hopefully this helps you to install either PyQt4 or PyQt5.
For Windows:
download the appropriate version of the PyQt4 from here:
and install it using pip (example for Python3.6 - 64bit)
Earlier PyQt .exe installers were available directly from the website download page. Now with the release of PyQt4.12 , installers have been deprecated. You can make the libraries work somehow by compiling them but that would mean going to great lengths of trouble.
Otherwise you can use the previous distributions to solve your purpose. The .exe windows installers can be downloaded from :
You can't use pip. You have to download from the Riverbank website and run the installer for your version of python. If there is no install for your version, you will have to install Python for one of the available installers, or build from source (which is rather involved). Other answers and comments have the links.
If you have error while installing PyQt4.
My system type is 64 bit, But to solve this error I have installed PyQt4 of 32 bit windows system, i.e PyQt4-4.11.4-cp27-cp27m-win32.whl - click here to see more versions.
output image
Kindly select appropriate version of PyQt4 according to your installed python version.