Reputation: 6586
>>> from PyQt4.QtCore import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4.QtCore
I have been trying to install PyQt4.QtWebKit, but have run into problems. I followed these instructions.
I am able to do Install(./configure,make,make install) SIP fine. I just can't do it in PyQt.
The error was:
ubuntu@ip-10-32-157-231:~/Desktop/build/PyQt$ sudo python configure.py --verbose -q /usr/bin/qmake
Determining the layout of your Qt installation...
/usr/bin/qmake -o qtdirs.mk qtdirs.pro
make -f qtdirs.mk
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -o qtdirs.o qtdirs.cpp
qtdirs.cpp:1:28: fatal error: QCoreApplication: No such file or directory
compilation terminated.
make: *** [qtdirs.o] Error 1
Error: Failed to determine the layout of your Qt installation. Try again using
the --verbose flag to see more detail about the problem.
ubuntu@ip-10-32-157-231:~/Desktop/build/PyQt$
Could you please suggest the solution to install PyQt4 successfully in ubuntu natty(11.04) and python 2.7+?
Upvotes: 2
Views: 4818
Reputation: 4564
The 'tutorial' is utter bullshit and will screw up your system. Sadly, I followed it too after getting frustrated with zips and build not working (I didn't know it was in the Ubuntu repositories).
Anyway, just run this code in the terminal:
sudo apt-get purge python-qt4 python-sip
sudo apt-get install python-qt4 python-sip
That should fix the problem. Optionally, you can do this in Synaptic too...
Upvotes: 1
Reputation: 120798
The instructions you have followed are misleading and wrong.
You do not need to build anything to get PyQt4 with QWebKit on ubuntu 11.04, because it already has all the necessary packages.
I would suggest you rollback any changes you've made as a result of following those instructions, and start again.
To get a basic PyQt4 installation, you just need to install these packages:
(plus any dependencies, of course).
Upvotes: 5