我安装了PyQt4,我有xcode,Qt,Sip和Python 2.7。当我检查终端时,它说安装了PyQt,当我查看路径时,路径中没有PyQt。我把它放在之前的路径中,但是当我关闭shell时它会消失。当我尝试导入它时,它没有名为PyQt4的模块。帮助
brew install pyqt
Warning: pyqt-4.11.4 already installed
>>> for f in sys.path:
print f
/Users/lucygrant/Documents
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
/Library/Python/2.7/site-packages
>>> import PyQt4
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import PyQt4
ImportError: No module named PyQt4
答案 0 :(得分:0)
假设将PATQt4添加到PATH之前解决了您的问题,请再次执行,除非现在在〜/ .bashrc文件中执行此操作。所以,如下:
source ~/.bashrc
。