导入PyQt5时DLL加载失败
我已经在Windows平台上安装了PyQt5,并且遇到了importError:DLL加载失败。
I have installed PyQt5 on windows platform and and getting an importError: DLL load failed.
我已经使用以下命令安装了pyqt5
I have installed pyqt5 using the command
pip3 install pyqt5
Successfully installed pyqt5-5.8.1
我的Python版本如下:
My Python version is as follows:
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
$ b上的[MSC v.1900 64 bit(AMD64)] $ b
导入错误如下:
The import Error is as follows:
from PyQt5.QtWidgets import QApplication
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
感谢&问候
这是因为缺少 Python3.dll
(存根dll) ,重新导出 Python3x.dll
函数,以便扩展的一个版本可以适用于多个版本的python。)
It is because of missing Python3.dll
(stub dll, that re-exports Python3x.dll
functions, so that one version of extension can work for multiple versions of python).
如果您的Python发行版未捆绑python3.dll,则可以尝试从WinPython( https:// winpython。 github.io/ )。
If your Python distro doesn't bundle python3.dll, you can try one from WinPython (https://winpython.github.io/).
至少2017/04/01版本应该有它。
At least the 2017/04/01 versions should have it.
1)下载WinPython(零版本即可;必须与Python一样是主版本-3.5 / 3.6-和位数-32/64-!!!)。
1) Download WinPython ('Zero' version suffices; must be same "main version" - 3.5/3.6 -and "bitness" - 32/64 - as your Python !!!).
2)提取到某个临时目录,将python3.dll粘贴到python3x.dll旁边的python目录中。
2) Extract to some temp directory, take the python3.dll and stick it into your python dir, next to the python3x.dll.
3)享受工作QT