Python 2.7 Cannot Import Pyqt4
Solution 1:
As PyQt is not using setup.py it cannot be installed using pip or easy_install
Here you have a tutorial showing how to build and install PyQt for python2.7:
http://problemssol.blogspot.com/2010/12/compile-and-install-pyqt4-for-python27.html
Update: For Ubuntu 12.04+ just use apt-get:
apt-get install python-qt4
Solution 2:
Under Ubuntu system, you could install it via apt-get
apt-get install python-qt4
Solution 3:
OSX 10.8.2 tested:
sudo pip install SIP
got IOError: [Errno 2] No such file or directory: '/tmp/pip-build/SIP/setup.py'
It's ok then:
cd /tmp/pip-build/SIP
sudo python configure.py
make
sudo make install
download PyQt from: http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.9.6/PyQt-mac-gpl-4.9.6.tar.gz
unzip it.
cd PyQt-mac-gpl-4.9.6
sudo python configure.py
make
it will take a while, after make then:
sudo make install
Enjoy it :)
Solution 4:
You can download any version of PyQt4 here for any version of Python but since you asked for python 2.7, Here is the link for the download for python 2.7:
https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/
Solution 5:
You should install PyQt4 in the Python 2.7 environment. To do this run
easy_install2.7 PyQt4
If easy_install is not installed you will need to first download and install it by running
python2.7 setup.py install
Post a Comment for "Python 2.7 Cannot Import Pyqt4"