python – ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLLs are there

python – ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLLs are there

Unofficial Windows Binaries for Python Extension Packages

you can find any python libs from here

Please check if the python version you are using is also 64 bit. If not then that could be the issue. You would be using a 32 bit python version and would have installed a 64 bit binaries for the OPENCV library.

python – ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLLs are there

Wow, I found yet another case for this problem. None of the above worked. Eventually I used pythons ability to introspect what was being loaded. For python 2.7 this means:

import imp
imp.find_module(cv2)

This turned up a completely unexpected cv2.pyd file in an Anaconda DLL directory that wasnt touched by multiple uninstall/install attempts. Python was looking there first and not finding my good installation. I deleted that cv2.pyd file and tried imp.find_module(cv2) again and python immediately found the right file and cv2 started working.

So if none of the other solutions work for you, make sure you use python introspection to see what file python is trying to load.

Leave a Reply

Your email address will not be published.