简体   繁体   English

无法从PyQt4导入QtGui

[英]Can't import QtGui from PyQt4

I downloaded PyQt4 , sadly when i try to import PyGui it replies with the following error : 我下载了PyQt4,遗憾的是当我尝试导入PyGui时,它回复了以下错误:

  >>> from PyQt4 import QtGui
Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    from PyQt4 import QtGui
ImportError: cannot import name 'QtGui'

so i tried to use different methods to import the module : 所以我尝试使用不同的方法导入模块:

>>> from PyQt4.QtGui import *

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    from PyQt4.QtGui import *
ImportError: No module named 'sip'

After that i tried to install "sip" module , results are : 之后我尝试安装“sip”模块,结果如下:

Could not find a version that satisfies the requirement sip (from versions: ) No matching distribution found for sip 找不到满足sip要求的版本(来自版本:)没有为sip找到匹配的分发

Note : My python version is 3.5 注意 :我的python版本是3.5

Update : I Uninstalled Python3.5.1 and replaced it with Python3.4 , yet there's no results. 更新我卸载了Python3.5.1并将其替换为Python3.4 ,但没有结果。

 >>> from PyQt4 import QtGui
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: DLL load failed: The specified module could not be found.

update2 : I tried to copy Qtcore4.dll and QtGui.dll to main dictionary but no Results. update2 :我试图将Qtcore4.dll和QtGui.dll复制到主词典但没有结果。

It's been a while since I had to set this up, but I believe the python Qt bindings require some of the DLL's included in the VC2015 C++ redistributable: 自从我必须设置它以来已经有一段时间了,但我相信python Qt绑定需要VC2015 C ++可再发行组件中包含的一些DLL:

https://www.microsoft.com/en-us/download/details.aspx?id=48145 https://www.microsoft.com/en-us/download/details.aspx?id=48145

If installing that one doesn't work for you, grab Process Monitor/Process explorer and watch for the DLL's it tries to load, and see which one it fails on. 如果安装那个不适合您,请抓住Process Monitor / Process explorer并观察它尝试加载的DLL,并查看它失败的DLL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM