[英]from PyQt4 import QtGui ImportError: cannot import name 'QtGui'
I'm new to UI design using qt - I installed qt and the pyqt4 wrapper. 我是使用qt进行UI设计的新手-我安装了qt和pyqt4包装器。
I have this simply 'hello world' type script here: 我在这里有这个简单的“ hello world”类型脚本:
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()
Yet I get this error: 但是我得到这个错误:
C:\\Python34\\python.exe C:/Users/me/Desktop/python/testqt.py Traceback (most recent call last): File "C:/Users/Leo/Desktop/python/testqt.py", line 2, in from PyQt4 import QtGui ImportError: cannot import name 'QtGui' C:\\ Python34 \\ python.exe C:/Users/me/Desktop/python/testqt.py回溯(最近一次调用):文件“ C:/Users/Leo/Desktop/python/testqt.py”,第2行,从PyQt4导入QtGui ImportError:无法导入名称'QtGui'
The existing answers on SE do not seem to help. SE上的现有答案似乎无济于事。 What causes this? 是什么原因造成的?
In my case I installed the PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x32.exe and it worked 就我而言,我安装了PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x32.exe,它可以正常工作
-- previously I had installed PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x64.exe and got the error reported above. -以前我已经安装了PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x64.exe并得到了上面报告的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.