【发布时间】:2015-02-04 01:23:23
【问题描述】:
我已按照以下说明操作:
http://danmarner.com/2014/04/23/Installing-PyQt5-with-Python-3-On-OS-X.html
首先根据以下位置的说明安装 SIP:
http://pyqt.sourceforge.net/Docs/sip4/installation.html
然后按照此处的说明进行 PyQt5:
http://pyqt.sourceforge.net/Docs/PyQt5/installation.html
然后brew install qt5
但是当我运行第一个示例 PyQt-gpl-5.3.2/examples/tutorials/addressbook/part1.py 时,它会失败并显示以下内容:
Traceback (most recent call last):
File "examples/tutorials/addressbook/part1.py", line 45, in <module>
from PyQt5.QtCore import Qt
ImportError: No module named PyQt5.QtCore
我正在运行 Mavericks 10.9.5 和 Python 2.7.5
好像没有正确安装,或者是python找不到。我不确定如何进行,因此非常感谢任何建议!
【问题讨论】:
-
python和qt5都需要通过brew安装。并且 brew 需要在您的路径中。
-
感谢@Kash,我已经用自制软件安装了python,它似乎在我的路径
/usr/local/bin中,但运行该示例仍然会产生相同的错误。 -
你能做到吗:
from PyQt5.QtWidgets import QtGui, QtCore? -
打开 IDLE 并导入 PyQt5。如果没有错误,那么您成功导入。否则不是。这就是检查模块是否正常的方法
-
@Kash 它以
ImportError: No module named PyQt5.QtWidgets失败我觉得它与我的路径有关