Unable to import cv2 module (Python 3.6)

為{幸葍}努か 提交于 2019-12-10 09:11:47

问题


total nexwbie here.

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

I typed the following commands in the 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 ?


回答1:


Try to do:

pip3 install opencv-python



回答2:


It works for python 3.5

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

Use pip install below instead:

python -m pip install opencv-python

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



来源:https://stackoverflow.com/questions/50909569/unable-to-import-cv2-module-python-3-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!