Python windows, ImportError: DLL load failed: 找不到指定的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32671918/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 12:02:13  来源:igfitidea点击:

windows, ImportError: DLL load failed: The specified module could not be found

pythonwindowsopencvnumpydll

提问by Jahid Rahman

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('12.jpg',0)
orb = cv2.ORB()
kp = orb.detect(img,None)
kp, des = orb.compute(img, kp)
img2 = cv2.drawKeypoints(img,kp,color=(0,255,0), flags=0)
plt.imshow(img2),plt.show()

I have added the numpyand cv2modules to my python directory and set their environment variables.

我已将numpycv2模块添加到我的 python 目录并设置它们的环境变量。

I also installed msvcp71.dlland msvcr71.dll, but this error has not solved.

我也安装了msvcp71.dlland msvcr71.dll,但是这个错误没有解决。

So how can i fix this kind of dll problem?

那么我该如何解决这种 dll 问题呢?

Version information:

版本信息:

  1. Python 3.2

  2. numpy-1.6.1-win32-superpack-python3.2

  3. opencv-3.0.0

  1. 蟒蛇 3.2

  2. numpy-1.6.1-win32-superpack-python3.2

  3. opencv-3.0.0

回答by zhangxaochen

I suspect you've mixed a x64pythonwith x86cv2.pydfile, or vice versa. Simple way is to install a right version of opencv here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

我怀疑您将x64pythonx86cv2.pyd文件混合在一起,反之亦然。简单的方法是在此处安装正确版本的 opencv:http: //www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

See discussions here:

请参阅此处的讨论:

  1. ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there
  2. How to use OpenCV in Python?
  1. 导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序。但是DLL在那里
  2. 如何在 Python 中使用 OpenCV?

To check your pythonarch:

检查您的python足弓:

In [2]: import platform

In [3]: platform.architecture()
Out[3]: ('64bit', 'WindowsPE')

and cv2.pyd: I suggest using PESnoop:

cv2.pyd:我建议使用PESnoop

D:\Anaconda\Lib\site-packages> PESnoop cv2.pyd /pe_dh
-------------------------------------------------------------------------------
 PESnoop 2.0 - Advanced PE32/PE32+/COFF OBJ,LIB command line dumper by yoda
-------------------------------------------------------------------------------

Dump of file: cv2.pyd...
Modus:        64bit Portable Executable Image...

discussions:

讨论:

https://serverfault.com/questions/29958/how-to-tell-if-a-windows-application-requires-64-bit

How can I determine for which platform an executable is compiled?

https://serverfault.com/questions/29958/how-to-tell-if-a-windows-application-requires-64-bit

如何确定为哪个平台编译了可执行文件?