ImportError: DLL load failed: %1 is not a valid Win32 application
Does anyone know how to fix this? This problem occurs when i am trying to import cv2. My laptop is 64bit and installed 64bit python, i also put the cv2.pyd file in the site-packages folder of Python.
My PYTHONPATH
value = C:\Python35;C:\Python35\DLLs;C:\Python35\Lib;C:\Python35\libs;C:\Users\CV\OpenCV\opencv\build\python\2.7\x64;%OPENCV_DIR%\bin;
My OPENCV_DIR
value = C:\Users\CV\OpenCV\opencv\build\x64\vc12
I also put reference of my pythonpath and my opencv_dir to the PATH by putting **%PYTHONPATH%;%PYTHONPATH%\Scripts\;%OPENCV_DIR%;**
I also installed opencv_python-3.0.0+contrib-cp35-none-win_amd64 through pip install and command line.
None of this solved my problem.
PATH
orPYTHONPATH
? Some of those directories (e.g. DLLs, Lib, libs) should be in neither of those environment variables. – Eryk SunC:\Python35;C:\Python35\DLLs;C:\Python35\Lib;C:\Python35\libs
in yourPYTHONPATH
. It also shouldn't have any directories with implementation-specific modules such asC:\Users\CV\OpenCV\opencv\build\python\2.7\x64
-- sincePYTHONPATH
isn't versioned. I also doubt that%OPENCV_DIR%\bin
contains Python modules. It may be necessary for it to be on the systemPATH
for finding DLLs. – Eryk Suncv2.cp35-win_amd64.pyd
, so you shouldn't have to do anything else. Remove everything else that you've done since it will only get in the way and cause problems if Python finds the wrong version of cv2 onsys.path
. Start from a fresh install of Python if you have to, and clean up the systemPATH
to remove all references to OpenCV directories. – Eryk Sun