8

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 ?

Janjouneh
  • 145
  • 1
  • 2
  • 9

2 Answers2

21

Try to do:

pip3 install opencv-python
  • Thank you so much. Can you please tell me why I don't have to specify the path and what does -python stands for? – Janjouneh Jun 18 '18 at 12:55
  • And do you know why [ C:\Users\leahj>C:\Users\leahj\AppData\Local\Programs\Python\Python36\Scripts\pip3 install NumPy] worked ? – Janjouneh Jun 18 '18 at 13:03
  • 1
    The numpy one worked because that's what the library is called. It's up to the developer to chose what name the library gets. Sometimes the name is already taken and so he has to chose an alternative one. As for the path, you don't need to specify it because it automatically does it for you. –  Jun 18 '18 at 13:16
  • But isn't opencv the name of a library too ? – Janjouneh Jun 18 '18 at 13:49
  • It is. Another similar thing happens with Tkinter too. It depends on how it is named in PyPi. https://pypi.org/project/opencv-python/ –  Jun 18 '18 at 15:34
7

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/

Samer Ayoub
  • 981
  • 9
  • 10
  • here what's the use of -m parameter? – Divyang Shah Sep 03 '19 at 15:56
  • 1
    @DivyangShah -m is used to run library module as a script. For more info use >python -h. Above user has used full command instead of short pip command, possibly he has not added python path to system directory. – Akshay Gaikwad Dec 08 '20 at 16:05