9

I'm having some trouble installing OpenCV. I have been using Anaconda, and I copied the cv2.pyd file into the ...\Lib\site-packages folder. When I get type import cv2 into Python I get this error:

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

I've also tried a pip install via command prompt: C:\Users\SCD>pip install cv2 results: `

Collecting cv2
Could not find a version that satisfies the requirement cv2 (from versions: )
No matching distribution found for cv2`

Can someone help?

SCD
  • 91
  • 1
  • 1
  • 5
  • 1
    Possible duplicate of [Installing OpenCV for Python on Ubuntu, getting ImportError: No module named cv2.cv](http://stackoverflow.com/questions/25215102/installing-opencv-for-python-on-ubuntu-getting-importerror-no-module-named-cv2) – TemporalWolf Jun 28 '16 at 20:26
  • Where did you get `cv2.pyd`? – MattDMo Jun 28 '16 at 20:47
  • Did u solve the problem? I have the same issue and don't know what I should do... – Kjenos Oct 14 '16 at 09:08
  • @MattDMo the [official document](https://docs.opencv.org/4.7.0/d0/de3/tutorial_py_intro.html) says download and copy `cv2.pyd`, and there's no instruction related to pypi package `opencv-python` at all. – Lei Yang Apr 20 '23 at 01:53
  • 1
    @LeiYang that's because the PyPI package didn't exist when the tutorial was written back in 2013. That tutorial hasn't changed in years, and as it says in that link, it's focused on OpenCV 3.x - we are now on 4.7.0. A lot has changed in the last 10 years. – MattDMo Apr 25 '23 at 20:25

3 Answers3

31

Had the same problem, solved by using the below command to install "opencv-python":

pip install opencv-python
Chilloutman
  • 457
  • 2
  • 13
ElMix
  • 311
  • 3
  • 4
-1

I think the proper input should be 'import cv2' not 'install cv2'. After this print cv2.version should show you that it installed properly. Hope this helps.

Nick Read
  • 7
  • 6
-3

Try running the following:

$ python
>>> import cv2
>>> print cv2.__version__
nisargap
  • 25
  • 3