Unable to import cv2; Msgstr "Error loading DLL"

I really did not want to start my own question with this, because this seems to be a common mistake here. However, after spending several hours on it now and after every thread that I could find, none of these answers sorted it out for me.

Therefore, my only option is to provide all the information I can about the setup, and I hope that one of you can recognize the problem.

I am running Windows 10 (x64) and have installed the following prebuilt binaries from the collection here .

  • python 3.5.0-win32 (installed from the python website)
  • numpy 1.10-cp35-win32
  • matplotlib 1.4.3-cp35-win32
  • opencv 3.0.0-cp35-win32

Everything was installed using "pip install file_name.whl" without error messages. However, the difference open cv will not be imported, and I get the following error:

>>> import cv2 Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.4\helpers\pydev\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) ImportError: DLL load failed: The specified module could not be found. 

cv2.cp35-win32.pyd plus many .dll files installed on C: \ Python35 \ Lib \ site-packages

I tried renaming cv2.cp35-win32.pyd to cv2.pyd and copy the .dll files to C: \ Python35 \ DLL,

I tried using another oprentv python package downloaded from the site, adding the bin directory to my PATH environment and moving the cv2.pyd file to C: \ Python35 \ Lib \ site packages

The same error appears every time. Any help would be appreciated!

+13
python windows numpy windows-10 opencv
Oct 18 '15 at 15:59
source share
6 answers

In my situation, when using Pycharm to import cv2, it returned ImportError: DLL not found . However, using the python int intrereter to import, I got * ImportError: ... not a win32 DLL ... * . So, in this situation, I had to download the Visual C ++ 2015 redistribution package and solve the problem.

Therefore, to everyone who encounters the same error, make sure that you have the VC ++ redistribution package that was used to compile the modularized DLL.

+9
Dec 21 '15 at 7:21
source share

I had a bug with Python 3.4 and opencv-python 3.3 on Windows 10. In my case, the problem was with my Anaconda distribution. I solved this with a solution from the opencv-python project page which points to this github .

The problem is the absence of python3.dll in the anaconda distribution. You can download the python binaries here and extract the dll from the zip archive. Put it in a folder in your PATH (e.g. C: \ Users \ MyName \ Anaconda3) and the import should work.

+8
Aug 25 '17 at 2:00
source share

This worked for me:

pip install opencv-contrib-python

(Running Python 3.6.3 - 32bit, on Windows 7 - 64 bit)

+4
Dec 14 '17 at
source share

So, I have a job, completely uninstalling everything and from the very beginning with Python 2.7.10.

It just doesnโ€™t work with Python 3. For clarity, in what I did, I followed these two videos in the order in which I place them:

How to install opencv + dependencies

How to set up a path variable

+1
Oct 18 '15 at 18:24
source share

I solved this by adding the path to the opencv dll into the PATH environment variable

You can follow this guide on how to add the path to an environment variable.

+1
Aug 17 '17 at 3:57 on
source share

I managed to solve the problem of removing all Visual C ++ redistributable packages before 2008, and then installing Visual C ++ redistributable packages for VS 2015. Explanation here: http://answers.opencv.org/question/74384/opencv-python -30-with-python-35-on-windows /

0
Sep 21 '16 at 8:05
source share



All Articles