简体   繁体   中英

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

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 numpy and cv2 modules to my python directory and set their environment variables.

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

So how can i fix this kind of dll problem?

Version information:

  1. Python 3.2

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

  3. opencv-3.0.0

I suspect you've mixed a x64 python with x86 cv2.pyd file, or vice versa. Simple way is to install a right version of opencv here: 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?

To check your python arch:

In [2]: import platform

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

and cv2.pyd : I suggest using 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM