SevenSoda
SevenSoda

Reputation: 123

openCV DLL load failed: %1

>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 er ikke et gyldigt Win32-program.
>>>

I downloaded the newest version of openCV from https://sourceforge.net/projects/opencvlibrary/files/opencv-win/

Then copied the x64.pyd from folder C:\opencv\build\python\2.7 to C:\Anaconda3\Lib\site-packages but it still complaints.

Python 3.5.1 |Anaconda 4.0.0 (64-bit)[MSC v.1900 64 bit (AMD64)] on win32 

I saw an answer from another post here: ImportError: DLL load failed: %1 is not a valid Win32 application I found 2 dll files in my C:\opencv\build\bin and sat that path to my system variables. But did not result in success.

Upvotes: 2

Views: 1397

Answers (1)

linusg
linusg

Reputation: 6439

The Python OpenCV DLL must be made for your version of Python and your system architecture.

You could try each of these steps:

  • Download OpenCV for your Python version (2/3)
  • Try replacing the x64 version with the x86 version, AFAIK if you have installed the more common Python 32bit on a x64 system, you'll still need the x86/32bit version of OpenCV
  • There are a lot of different binaries here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv. Try to get the one exactly matching your Python version and System architecture and install it via pip (cp35 means CPython version 3.5 etc.).

    If you have the OpenCV .whl file matching your system configuration, do

    pip install file.whl
    

At least the last one should definitively work!

Upvotes: 3

Related Questions