我在Mac Yosemite 10.10.5上使用PyQt4 . 和Python 2.7 . 当我尝试使用sublime文本运行一个简单的脚本时,我得到了

´ImportError: cannot import name QtGui.

但是当我通过终端进入python并输入以下行时,它似乎接受了它 .

>>> from PyQt4 import QtGui
>>>

我试图在Sublime Text中运行的脚本是:

import sys


from PyQt4 import QtGui


def main():

    app = QtGui.QApplication(sys.argv)

    w = QtGui.QWidget()
    w.resize(250, 150)
    w.move(300, 300)
    w.setWindowTitle('Simple')
    w.show()

    sys.exit(app.exec_())


if __name__ == '__main__':
       Main()

我的Pyqt4路径位于/Library/Python/2.7/site-packages .

我的sys-path输出是:

['','/ System / Library / Frameworks / Pepy.framework / Version / 2.7 / lib / python27.zip','/ System / Library / Frameworks / Pepy.framework / Version / 2.7 / lib / python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin','/ System / Library / Frame /Python.framework / Version / 7.7 / lib / python2.7 / plat -mac','/ System / Library / Frame /Python.framework / Version / 2.7 / lib / python2.7 /plat-make / lib -scriptpackages','/ System / Library / Frame /Python.framework / Version / 2.7 / Extras / lib / python','/ System / Library / Frame /Python.framework / Version / 1.7 / lib / python2.7 / lib -tk','/ System / Library / Frame /Python.framework / Version / 2.7 /lib/python2.7/lib-old','/ System / Library / Frame /Python.framework / Version / 7.7 / lib / python2.7 / lib-dadload','/ Users / cameramacintyre / Library /Python / 2.7 / lib / python / site-packages','/ System / Library / Frame /Python.framework / Version / 7.7 / Extras / lib / python / PyybjC','/ Library /Python / 2.7 / site-package']

我使用sip安装并安装了以下PyQt4:

python configure.py -q /usr/bin/qmake-4.8 -d /Library/
Python/2.7/site-packages/ --use-arch x86_64
•
make 
•
sudo make instal

我已经搜索了几天其他类似的问题,但无法找到解决方案 . 我是一个新手,所以任何帮助将不胜感激 .

ps我安装了Python 3已经有一段时间了,但我删除了它 .