我在centos5上.我用make altinstall安装了python26源代码.然后我做了一个:
yum install qt4 yum install qt4-devel yum install qt4-doc
从riverbankcomputing.co.uk我下载了sip 4.10.2的源代码,编译并安装得很好.然后从我从源PyQt-x11-4.7.3下载和编译的同一站点
两个安装都使用python26版本(/usr/local/bin/python2.6).所以configure.py,make和make install都没有错误.最后,我试图运行这个脚本,但在这篇文章的主题中得到了错误:
import sys import signal from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import QWebPage def onLoadFinished(result): if not result: print "Request failed" sys.exit(1) #screen = QtGui.QDesktopWidget().screenGeometry() size = webpage.mainFrame().contentsSize() # Set the size of the (virtual) browser window webpage.setViewportSize(webpage.mainFrame().contentsSize()) # Paint this frame into an image image = QImage(webpage.viewportSize(), QImage.Format_ARGB32) painter = QPainter(image) webpage.mainFrame().render(painter) painter.end() image.save("output2.png") sys.exit(0) app = QApplication(sys.argv) signal.signal(signal.SIGINT, signal.SIG_DFL) webpage = QWebPage() webpage.connect(webpage, SIGNAL("loadFinished(bool)"), onLoadFinished) webpage.mainFrame().load(QUrl("http://www.google.com")) sys.exit(app.exec_())
即使在pyqt4的配置开始时,我也看到它应该安装QtWebKit,但显然它不是?这是怎么回事?
我刚做了一个发现,看起来好像没有安装.我有什么选择?
[root@localhost ~]# find / -name '*QtWebKit*' /root/PyQt-x11-gpl-4.7.3/sip/QtWebKit /root/PyQt-x11-gpl-4.7.3/sip/QtWebKit/QtWebKitmod.sip /root/PyQt-x11-gpl-4.7.3/cfgtest_QtWebKit.cpp
小智.. 6
apt install python-pyqt5.qtwebkit
apt install python-pyqt5.qtwebkit