I am on centos5. I installed python26 source with a make altinstall. Then I did a:
yum install qt4
yum install qt4-devel
yum install qt4-doc
<
Double check to make sure that the Qt installation on your system has the Webkit library built.
Also, check to make sure that the QtWebKit.so exists in your python2.6/site-packages/PyQt4 directory.
apt install python-pyqt5.qtwebkit
install the qt44/qt44-x11/qt44-devel rpms from the atrpms el5 repo.
http://atrpms.net/dist/el5/qt4/
install the python module PySide
, for example with:
pip install PySide
adn then change your imports from:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import QWebPage
to:
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import QWebPage
Alternatively you could use PySide just a s a fall back, so you can keep your code compatible with older systems too:
try:
# NOTE We need to try importing QtWebKit first,
# because it is the most likely one to not be available,
# and all used QT classes need to come from the same module,
# to be compatible with each other.
from PyQt4.QtWebKit import QWebPage
from PyQt4.QtCore import *
from PyQt4.QtGui import *
except ImportError:
try:
from PySide.QtGui import *
from PySide.QtWebKit import QWebPage
except ImportError:
raise Exception("We require PyQt4 (with QtWebKit) or PySide")
NOTE In the long run you should change to QT5 though, as the above are basically just workarounds.