本文介绍了导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序.但是DLL在那里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况非常像 导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序,但那里的答案对我不起作用.

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.

我的 Python 代码说:

My Python code says:

import cv2

但是该行会引发此问题标题中显示的错误.

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

我在这台 64 位机器上的 C:libopencv 中安装了 OpenCV.我使用的是 64 位 Python.

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

我的 PYTHONPATH 变量:PYTHONPATH=C:libopencvuildpython2.7.该文件夹包含 cv2.pyd,仅此而已.

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

我的PATH变量:Path=%OPENCV_DIR%in;... 该文件夹包含39个DLL文件,例如opencv_core246d.dll.

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

OPENCV_DIR 有这个值:OPENCV_DIR=C:libopencvuildx64vc11.

OPENCV_DIR has this value: OPENCV_DIR=C:libopencvuildx64vc11.

ImportError: DLL load的解决方案失败:%1 不是有效的 Win32 应用程序 说要添加新的 opencv 二进制文件路径 (C:opencvuildinRelease) 到 Windows PATH 环境变量".但如上所示,我的 PATH 中已经有 OpenCV 二进制文件夹 (C:libopencvuildx64vc11in).而且我的 OpenCV 安装没有任何 Release 文件夹(除了 build/java 下的一个空文件夹).

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).

任何关于出了什么问题的想法?我可以告诉 Python 详细跟踪加载过程吗?它究竟在寻找什么 DLL?

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?

谢谢,拉斯

我刚刚注意到,根据 http://www.dependencywalker.com/,C:libopencvuildpython2.7 中的 >cv2.pyd 是 32 位的,而我运行的机器和 Python 是 64 位的.这可能是问题吗?如果是这样,我在哪里可以找到 64 位版本的 cv2.pyd?

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?

推荐答案

Python 扩展包的非官方 Windows 二进制文件

你可以从这里找到任何 python 库

you can find any python libs from here

这篇关于导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序.但是DLL在那里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!