无法导入 cv2 模块(Python 3.6)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50909569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:38:11  来源:igfitidea点击:

Unable to import cv2 module (Python 3.6)

pythonopencvpython-3.6cv2

提问by Janjouneh

total nexwbie here.

总nexwbie在这里。

I'm unsuccessfully trying to install the cv2module for python but it doesn't work. I'm working with Python 3.6 (64bits)

我尝试为 python安装cv2模块失败,但它不起作用。我正在使用 Python 3.6(64 位)

I typed the following commands in the cmd :

我在 cmd 中输入了以下命令:

C:\Users\leahj>C:\Users\leahj\AppData\Local\Programs\Python\Python36\Scripts\pip3 install cv2
Collecting cv2
  Could not find a version that satisfies the requirement cv2 (from versions: )
No matching distribution found for cv2

C:\Users\leahj>C:\Users\leahj\AppData\Local\Programs\Python\Python36\Scripts\pip3 install opencv
Collecting opencv
  Could not find a version that satisfies the requirement opencv (from versions: )
No matching distribution found for opencv

C:\Users\leahj>C:\Users\leahj\AppData\Local\Programs\Python\Python36\Scripts\pip3 install opencv2
Collecting opencv2
  Could not find a version that satisfies the requirement opencv2 (from versions: )
No matching distribution found for opencv2

I tried to look for answers on this site but couldn't find any. The most accurate thing I found was that : https://breakthrough.github.io/Installing-OpenCV/but it seems that I have to go back to an older version of Python ?

我试图在这个网站上寻找答案,但找不到任何答案。我发现的最准确的事情是:https://breakthrough.github.io/Installing-OpenCV/但似乎我必须回到旧版本的 Python ?

回答by

Try to do:

试着做:

pip3 install opencv-python

回答by Samer Ayoub

It works for python 3.5

它适用于 python 3.5

For python 3.6The conda install opencv and conda install -c conda-forge opencv methods for OpenCV continue to be BROKEN for video/image reading and display.

对于python 3.6,用于 OpenCV 的 conda install opencv 和 conda install -c conda-forge opencv 方法继续用于视频/图像读取和显示。

Use pip install below instead:

使用下面的 pip install 代替:

python -m pip install opencv-python

python -m pip install opencv-python

Reference: https://www.scivision.co/install-opencv-python-windows/

参考:https: //www.scivision.co/install-opencv-python-windows/