Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

python - ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

I have a situation very much like the one at ImportError: DLL load failed: %1 is not a valid Win32 application, but the answer there isn't working for me.

My Python code says:

import cv2

But that line throws the error shown in the title of this question.

I have OpenCV installed in C:libopencv on this 64-bit machine. I'm using 64-bit Python.

My PYTHONPATH variable: PYTHONPATH=C:libopencvuildpython2.7. This folder contains cv2.pyd and that's all.

My PATH variable: Path=%OPENCV_DIR%in;... This folder contains 39 DLL files such as opencv_core246d.dll.

OPENCV_DIR has this value: OPENCV_DIR=C:libopencvuildx64vc11.

The solution at ImportError: DLL load failed: %1 is not a valid Win32 application says to add "the new opencv binaries path (C:opencvuildinRelease) to the Windows PATH environment variable". But as shown above, I already have the OpenCV binaries folder (C:libopencvuildx64vc11in) in my PATH. And my OpenCV installation doesn't have any Release folders (except for an empty one under build/java).

Any ideas as to what's going wrong? Can I tell Python to verbosely trace the loading process? Exactly what DLL's is it looking for?

Thanks, Lars

EDIT:

I just noticed that, according to http://www.dependencywalker.com/, the cv2.pyd in C:libopencvuildpython2.7 is 32-bit, whereas the machine and the Python I'm running are 64-bit. Could that be the problem? And if so, where can I find a 64-bit version of cv2.pyd?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Unofficial Windows Binaries for Python Extension Packages

you can find any python libs from here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...