Python 3.5, OpenCV 3.2, Windows 7 64-bit, Anaconda 3, "ImportError: DLL loading error"

So many questions are already about this topic, but I did not find a satisfactory answer about the traditional "DLL not found" problem.

  • I am using Python 3.5 installed through Anaconda 3;
  • I installed โ€œofficialโ€ opencv_python-3.2.0.6-cp34-cp34m-win_amd64.whl with pip (right here https://pypi.python.org/pypi/opencv-python );
  • Windows version - 7 - 64 bit;
  • I uninstalled all the distributed VC ++ that were on my computer and reinstalled its 2015 version, so my laptop has the well-known and also the mandatory msvcp140.dll DLL;
  • cv2 module is present in the lib / site-packages directory;
  • it contains, among other things, the file 'cv2.cp35-win_amd64.pyd'.

Meanwhile, I still cannot access cv2:

>>> import cv2 Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> import cv2 File "C:\Program Files\Anaconda3\lib\site-packages\cv2\__init__.py", line 7, in <module> from . import cv2 ImportError: DLL load failed: The specified module could not be found. 

Changing the name .pyd โ†’ cv2.pyd does not solve the problem, as well as installing via pip an unofficial but different version of the wheels from Gohlke ( http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv )

Any idea what is going on?

+2
python dll cv2
Jan 25 '17 at 10:37
source share
3 answers

As already mentioned in a comment that I did not notice at the beginning, you can solve this by installing from an unofficial site (Gohlke) ( http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv )

I deleted the official by calling:

 pip uninstall opencv-python 

Then download the .whl package from the specified site (you need to carefully select the correct python version and the correct x86 or x64 processor architecture).

Then go to the path where the .whl file is loaded and called:

 pip install opencv_python-xxx-cpxx-cpxxm-win_xx.whl 
0
Apr 01 '17 at 14:16
source share

As for the comment in the question, always remove any existing opencv package before installing another, because opencv from unofficial and official sites will be considered 2 pip packages.

You can install the official opencv if you follow my answer here . You are getting this error due to a problem with Anaconda .

But if you install official opencv , it will be autocomplete and give suggestions in your python IDE (see this ). So, if you need autocompletion, you need to go with unofficial opencv.

0
Jun 10 '17 at 13:19 on
source share

I had the same problem. It helps me:

 conda install -c menpo opencv3 

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

0
Jul 13 '17 at 6:52
source share



All Articles