0
votes

import cv2

On executing the above code, it shows the following error.

Error:

Traceback (most recent call last) in () ----> 1 import cv2

ImportError: DLL load failed: The specified module could not be found.

Unable to import cv2 in python

I have installed OpenCV 2.4.13 and Anaconda3 with python 3.6.4.

OpenCV location:C:\Users\harsh\Anaconda3

Anaconda location:C:\Users\harsh\opencv.

I have also added cv2.pyd in C:\Users\harsh\Anaconda3\Lib\site-packages.

3

3 Answers

1
votes

Try pip install opencv-python instead of pip install cv2. Although the name of the package changes, you can still import it as import cv2, It will work.

0
votes

Have also experienced some issues with OpenCV and Anaconda. Anaconda can fetch only OpenCV 2.4, that might not suit your versions. You should try install OpenCV this way

pip install opencv-python
0
votes

This can happen if you are using windows 10 N distribution, the N distributions does not come pre installed with windows media feature pack, which is required after OpenCV version 3.4 and onwards.

The preferred solution is to install the feature pack at : https://www.microsoft.com/en-us/software-download/mediafeaturepack

Be careful to choose the version that works with your current version of windows.

If that is not an option, fall back to an earlier version of OpenCV that does not have dll dependencies, you can do that by:pip install opencv-python=3.3.0.9

If the problem still persists try using Dependency walker to find out where specifically your problems stem from and then try fixing them individually.

Since windows rolled out it's N version this problem has been seen at many places, and has many impacts across the windows environment, the fastest way to identify if you have this problem is open youtube in Edge browser, if it says HTML5 media plugin not found, this is the problem.

If the problem still persists feel free to add comments.