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?

5
  • 1
    Possible duplicate of Installing OpenCV for Python on Ubuntu, getting ImportError: No module named cv2.cv Commented Jun 28, 2016 at 20:26
  • Where did you get cv2.pyd? Commented Jun 28, 2016 at 20:47
  • Did u solve the problem? I have the same issue and don't know what I should do... Commented Oct 14, 2016 at 9:08
  • @MattDMo the official document says download and copy cv2.pyd, and there's no instruction related to pypi package opencv-python at all. Commented Apr 20, 2023 at 1: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. Commented Apr 25, 2023 at 20:25

3 Answers 3

31

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

pip install opencv-python
Sign up to request clarification or add additional context in comments.

1 Comment

This should be the answer.
-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.

1 Comment

Oh sorry, that's a typo. I did type 'import cv2' not install.
-3

Try running the following:

$ python
>>> import cv2
>>> print cv2.__version__

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.