I’ve upgraded to Python 2.7 from Python 2.6 on Ubuntu Maverick Meerkat (10.10) and I’m unable to import PyQt4.
austin@gerald:~$ python2.7 Python 2.7.0+ (r27:82500, Sep 15 2010, 18:04:55) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PyQt4 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named PyQt4
I installed both Python 2.7 (python2.7) and PyQt4 (python-qt4) from the Ubuntu repositories. I installed PyQt a while back, but I installed Python 2.7 recently.
If I try Python 2.6 (since it’s shipped with Ubuntu, the command is simply python), it works perfectly. Watch:
austin@gerald:~$ python Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PyQt4
I know what the problem is: the PyQt4 modules are accessible by Python 2.6 but not 2.7. My question is, how do I get Python 2.7 to find the PyQt4 module(s)? Help!
Note: sorry if this belongs in Super User, I was just programming when I encountered this problem.
Advertisement
Answer
Under Ubuntu system, you could install it via apt-get
apt-get install python-qt4