Cannot import PyQt4.QtGui

后端 未结 10 1940
情话喂你
情话喂你 2020-11-30 08:52

I have a working Python 2.6 install and just installed the PyQt4 built for Python 2.6 (available at http://www.riverbankcomputing.co.uk/software/pyqt/download). When I try t

相关标签:
10条回答
  • 2020-11-30 09:33

    Neither of the these solutions worked for me. I had Python 3.1 x64 with PyQt 4.8.2-1 x64 on my Windows 7 x64, but uninstalling them and installing the x86 versions of Python 3.1 and PyQt solved the problem for me.

    0 讨论(0)
  • 2020-11-30 09:39

    I found a solution on another forum that worked for me. I needed to copy QtGui4.dll and QtCore4.dll into the ...\Python2.7.1\Lib\site-packages\PyQt4 directory. Note, I left the original in the bin directory.

    0 讨论(0)
  • 2020-11-30 09:39

    If this does not works, try search for QtCore4.dll, QtGui4.dll, etc. in your paths set in PATH environment variable. In my case I found some qt dll in c:\windows\system32, caused the same error message. I've deleted the dll files, and problem solved. 'C:\Python26\Lib\site-packages\PyQt4\bin' was in my path, but that was not enough.

    0 讨论(0)
  • 2020-11-30 09:46

    Add the the PyQt4 directory containing Qt's applications and DLLs to your PATH environment variable. In PowerShell, provided you didn't change any of your install paths, that'd be

    $env:path += ';C:\Python26\Lib\site-packages\PyQt4\bin'
    
    0 讨论(0)
  • 2020-11-30 09:46

    None of these solutions worked for me with 64bit Python 3.5. I ended up rolling back Anaconda to 4.1.1 (4.2.0 uses a Qt5 by default, which may or may not be the problem). I also had to install pyqt from a python 3.5 whl - http://www.lfd.uci.edu/%7Egohlke/pythonlibs/#pyqt4.

    The binary file on the Riverbank website did not work for me, possibly it only works on Python 3.4?

    I have installed pyqt with Anaconda several times, and I believe if it is done correctly the PATH does not need modification (it happens as part of installation) and DLLs do not need to be copied.

    0 讨论(0)
  • 2020-11-30 09:52

    Download the program from http://www.dependencywalker.com to see if there was missing dll.

    You need to point the program to the QtGui.pyd file from PyQt.

    My case was using MSYS2's mingw-w64-x86_64-python3-pyqt4, it needed libpython3.5m.dll while pacman was already at python3.6

    0 讨论(0)
提交回复
热议问题