繁体   English   中英

导入 CV2:DLL 加载失败:pip 安装成功时找不到指定的模块

[英]Import CV2: DLL load failed: The specified module could not be found while successful pip installation

我在 Pycharm IDE (Windows10) 中使用 Python 3.7 和 OpenCV 4.2。 我的一位同事无意中更改了系统环境变量(我们不知道究竟发生了什么)。 然后我发现我的代码没有出现这个错误!:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

然后我使用了这个命令:

pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip install opencv-python

所有这些都成功执行,但是当我编写import cv2出现上述错误。 顺便说一句,系统知道命令Python ,它显示了python.exe的正确路径。 此外,像import numpy这样的命令可以正常工作! 我该如何解决这个问题?

我找到了答案! site-packages/cv2路径中有一个额外的cv2.py文件。 所以,我删除了它并且代码有效

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM