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

你可能感兴趣的:(PyQt5 import QtCore ImportError)