PyQt5导入模块的时候报错:
1.
ImportError: DLL load failed: 找不到指定的程序
2.
ImportError: DLL load failed: 找不到指定的模块
3.
ImportError: cannot import name 'QtCore'
以上报错的原因:PyQt5、PyQt5-sip和PyQt5-stub等模块版本不互通
解决方法如下:
- Win+R打开运行,输入cmd进入终端窗口
- 在命令行中依次输入
pip uninstall PyQt5 pip uninstall PyQt5-sip pip uninstall PyQt5-stubs
以及有关于PyQt5的模块(比如:pyqt5_tools)进行卸载
-
卸载完毕,再输入
pip install PyQt5
这样安装就已经包括对应版本的PyQt5-sip和PyQt5-stubs了,无需再进行安装
-
再依次把有关于PyQt5(刚刚卸载)的模块重新安装,比如:pip install pyqt5_tools
这样就可以成功运行了!