PyQt5 import QtCore ImportError

import QtCore的时候出错

from PyQt5 import QtCore
ImportError: DLL load failed while importing QtCore: 
  The specified procedure could not be found.

问题是 pip 安装的PyQt和其他package版本不对
最好使用conda进行安装

pip uninstall pyqt5
# pip uninstall pyqt5-tools
# pip uninstall pyqt5-plugins
conda install -c anaconda pyqt

也是我下面这个回答
https://stackoverflow.com/a/72949403/14497253

其他问题:

import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as plt

raise ImportError("Failed to import any qt binding") 
ImportError: Failed to import any qt binding

也是同样的原因

下面是网上其他的答案,我试了基本都没用

重新创建一个环境

https://blog.csdn.net/weixin_37706204/article/details/120492652

将Python3.dll拷贝到执行程序所在目录,调试执行,一切正常,问题解决。

https://blog.csdn.net/chinanier/article/details/103866953

https://forum.qt.io/topic/118934/importerror-dll-load-failed-while-importing-qtcore-the-specified-module-could-not-be-found/5

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容