我试图在CentOS 7中安装Ghost.py。我已经安装了下面的软件包,但似乎我错过了某些东西,或者某个地方没有路径。我真的在这里挣扎,不知道我错过了什么。
sudo yum install cmake qconf qt-devel qt4-devel python-devel PyQt4 PyQt4-devel PyQt4-web* xorg-x11-server-ver-Xvfb python-xvfbwrapper
sudo ln -s /usr/bin/qmake-qt4 /usr/bin/qmake
然后安装了PySide
sudo pip install PySide
sudo pip install Ghost.py
然后在我的翻译中,当我去导入它时,我明白了:
Python 2.7.5 (default, Jun 24 2015, 00:41:19)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ghost import Ghost
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/ghost/__init__.py", line 2, in <module>
from .ghost import (
File "/usr/lib/python2.7/site-packages/ghost/ghost.py", line 17, in <module>
from .bindings import (
File "/usr/lib/python2.7/site-packages/ghost/bindings.py", line 74, in <module>
QtWebKit = _import('QtWebKit')
File "/usr/lib/python2.7/site-packages/ghost/bindings.py", line 41, in _import
module = __import__(name)
ImportError: No module named QtWebKit
我不明白这一点,因为它在我的/usr/lib64/python2.7/site-packages/PyQt4
目录中:
[me@localhost PyQt4]$ ls -lah
total 16M
drwxr-xr-x. 3 root root 4.0K Sep 21 13:56 .
drwxr-xr-x. 43 root root 8.0K Sep 21 13:56 ..
-rw-r--r--. 1 root root 1.1K Jun 9 2014 __init__.py
-rw-r--r--. 2 root root 139 Jun 9 2014 __init__.pyc
-rw-r--r--. 2 root root 139 Jun 9 2014 __init__.pyo
-rwxr-xr-x. 1 root root 406K Jun 9 2014 phonon.so
-rw-r--r--. 1 root root 14K Jun 9 2014 pyqtconfig.py
-rw-r--r--. 2 root root 17K Jun 9 2014 pyqtconfig.pyc
-rw-r--r--. 2 root root 17K Jun 9 2014 pyqtconfig.pyo
-rwxr-xr-x. 1 root root 2.7M Jun 9 2014 QtCore.so
-rwxr-xr-x. 1 root root 236K Jun 9 2014 QtDBus.so
-rwxr-xr-x. 1 root root 267K Jun 9 2014 QtDeclarative.so
-rwxr-xr-x. 1 root root 354K Jun 9 2014 QtDesigner.so
-rwxr-xr-x. 1 root root 8.3M Jun 9 2014 QtGui.so
-rwxr-xr-x. 1 root root 125K Jun 9 2014 QtHelp.so
-rwxr-xr-x. 1 root root 148K Jun 9 2014 QtMultimedia.so
-rwxr-xr-x. 1 root root 771K Jun 9 2014 QtNetwork.so
-rwxr-xr-x. 1 root root 302K Jun 9 2014 QtOpenGL.so
-rwxr-xr-x. 1 root root 218K Jun 9 2014 QtScript.so
-rwxr-xr-x. 1 root root 27K Jun 9 2014 QtScriptTools.so
-rwxr-xr-x. 1 root root 6.8K Jun 9 2014 Qt.so
-rwxr-xr-x. 1 root root 347K Jun 9 2014 QtSql.so
-rwxr-xr-x. 1 root root 99K Jun 9 2014 QtSvg.so
-rwxr-xr-x. 1 root root 36K Jun 9 2014 QtTest.so
-rwxr-xr-x. 1 root root 472K Mar 31 2014 QtWebKit.so
-rwxr-xr-x. 1 root root 179K Jun 9 2014 QtXmlPatterns.so
-rwxr-xr-x. 1 root root 346K Jun 9 2014 QtXml.so
drwxr-xr-x. 6 root root 4.0K Sep 21 13:56 uic
答案 0 :(得分:0)
PyQt4位于您的站点包中,因此您必须导入该包。如果您特别想从PyQt4包中导入QtWebKit,那就是您必须要做的事情
from PyQt4 import QtWebKit