我剛剛從PyQt4移動到5,我遇到了QtGui的問題。我使用32位Windows安裝程序安裝,而不是我自己的版本。PyQt5無法導入QtGui
當我這樣做:
from PyQt5 import QtGui
我得到
class MainWindow(QtGui.QMainWindow, UI.MainUI.Ui_MainWindow):
AttributeError: 'module' object has no attribute 'QMainWindow'
所以我試圖
from PyQt5.QtWidgets import QtGui
導致:
ImportError: cannot import name QtGui
然後我試圖根據Pyinstaller: ImportError: cannot import name QtGui工作來改變周圍的sys.path但它仍然給了我同樣的
ImportError: cannot import name QtGui
更新:它看起來像我其實進口QtGui做,因爲當我去在空閒和嘗試它,它仍然自動完成QMovie和一大堆其他屬性。 QMainWindow是否有任何理由不在? (它不是,QDialog也看起來很重要)
建議使用Anaconda爲新手安裝開發環境。請[請按照我的文章](https://suiwenfeng.tk/pycharm-intigrated-with-pyqt5anaconda.html)一步一步。 – suiwenfeng