Importerror: No Module Named Pyqt4.qtcore
Solution 1:
As mentioned in the comments, you need to install the python-qt4
package - no need to recompile it yourself.
sudo apt-get install python-qt4
Solution 2:
I was having the same error - ImportError: No module named PyQt4.QtGui
. Instead of running your python file (which uses PyQt) on the terminal as -
python file_name.py
Run it with sudo privileges -
sudo python file_name.py
This worked for me!
Solution 3:
I had the same issue when uninstalled my Python27 and re-installed it.
I downloaded the sip-4.15.5 and PyQt-win-gpl-4.10.4 and installed/configured both of them. it still gives 'ImportError: No module named PyQt4.QtCore'. I tried to move the files/folders in Lib to make it looked 'have' but not working.
in fact, jut download the Windows 64 bit installer for a suitable Python version (my case) from http://www.riverbankcomputing.co.uk/software/pyqt/download and installed it, will do the job.
* March 2017 update *
The given link says, Binary installers for Windows are no longer provided.
See cgohlke's answer at, PyQt4 and 64-bit python.
- Download the .whl file at http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4.
- Use pip to install the downloaded .whl file.
Solution 4:
I had the "No module named PyQt4.QtCore" error and installing the python-qt4 package fixed it only partially: I could run
fromPyQt4.QtCoreimportSIGNAL
from a python interpreter but only without activating my virtualenv.
The only solution I've found till now to use a virtualenv is to copy the PyQt4 folder and the sip.so file into my virtualenv as explained here: Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox?
Solution 5:
You don't have g++ installed, simple way to have all the needed build tools is to install the package build-essential:
sudo apt-get install build-essential
, or just the g++ package:
sudo apt-get install g++
Post a Comment for "Importerror: No Module Named Pyqt4.qtcore"