简体   繁体   中英

Can't import QtGui from PyQt4

I downloaded PyQt4 , sadly when i try to import PyGui it replies with the following error :

  >>> 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 :

Could not find a version that satisfies the requirement sip (from versions: ) No matching distribution found for sip

Note : My python version is 3.5

Update : I Uninstalled Python3.5.1 and replaced it with Python3.4 , yet there's no results.

 >>> 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.

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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