为什么在Python3.6.0中导入cv2显示错误

2024-04-19 07:37:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我用命令安装了OpenCV

pip install OpenCV-python

在Python3.6.0中 但在代码中使用时显示错误
代码

^{pr2}$

错误

     File "<stdin>", line 1, in <module>
  File "C:\Users\yyy\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)
  File "C:\Users\yyy\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)
  File "C:/Users/yyy/Desktop/cameraPlay.py", line 1, in <module>
    import cv2 
  File "C:\Users\yyy\Anaconda3\lib\site-packages\cv2\__init__.py", line 7, in <module>
    from . import cv2
ImportError: DLL load failed: The specified module could not be found.

我尝试了不同的问题解决方案,但没有解决我的问题。


Tags: 代码inpylibpackages错误linesite
1条回答
网友
1楼 · 发布于 2024-04-19 07:37:01

这个问题似乎重复了以下问题:

DLL Load Failed Error when importing CV2

为了方便起见,我复制了这个问题的公认答案:

You can download the latest OpenCV 3.2.0 for Python 3.6 on Windows 32-bit or 64-bit machine, look for file starts withopencv_python‑3.2.0‑cp36‑cp36m, from this unofficial site. Then type below command to install it:

pip install opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl (32-bit version) pip install opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl (64-bit version) I think it would be easier.

作者:@thewaywewere

相关问题 更多 >