我在很多帖子中已經看到這個問題,但沒有任何答案對我有幫助。 所以,這是我的問題。無法從PyQt4導入QtGui
我在窗戶上。 我有蟒蛇3.6版本
1)我下載中心車輪文件(PyQt4中的PyQt4-4.11.4-CP36-cp36m-win_amd64.whl)有: http://www.lfd.uci.edu/~gohlke/pythonlibs/
而且我在這裏保存的是:C: \用戶\安妮 - 索菲•
2)我打開一個shell窗口admin和我運行 「PIP安裝PyQt4-4.11.4-CP36-cp36m-win_amd64.whl」
安裝似乎即使工作我收到消息:
Requirement 'PyQt4-4.11.4-cp36-cp36m-win_amd64.whl' looks like a filename, but the file does not exist
當我重新運行 「PIP安裝PyQt4-4.11.4-CP36-cp36m-win_amd64.whl」 我仍然得到這個消息,但我也得到"Requirement already satisfied: PyQt4==4.11.4 from file:///C:/WINDOWS/system32/PyQt4-4.11.4-cp36-cp36m-win_amd64.whl in c:\users\anne-sophie\anaconda3\lib\site-packages"
3)現在,當我打開一個Python筆記本並寫上「import PyQt4
」我沒有得到任何錯誤。
但是,當我寫from PyQt4 import QtGui
我得到的錯誤信息:ImportError: cannot import name 'QtGui'
4)我去C:\Users\Anne-Sophie\Anaconda3\Lib\site-packages\PyQt4
,我看到QtGui不是PyQt4中,但PyQt4中/ SIP所以我寫from PyQt4.sip import QtGui
這是工作... 。
5)我去這個網站beginers與PyQt4的: https://pythonprogramming.net/basic-gui-pyqt-tutorial/
而且我寫的:
import sys
from PyQt4.sip import QtGui
app = QtGui.QApplication(sys.argv)
我得到的錯誤:AttributeError: module 'PyQt4.sip.QtGui' has no attribute 'QApplication'
Finally here are my questions:
Q1: do you think that
Requirement 'PyQt4-4.11.4-cp36-cp36m-win_amd64.whl' looks like a filename, but the file does not exist
is a problem (step 2) if import PyQt4 is working?Q2: do you know what I am doing wrong? nobody is using
from PyQt4.sip import QtGui
so I am not sure that I should do it..... Moreover, even when I do it, I still get error when I go furtherQ3: does someone know how to make it work?