I try to import a module:
import cv
And I get the following error message:
ImportError: DLL load failed: The specified module could not be found.
But if I try to import a library that definitely does not exist, for example:
import blabla
I get:
ImportError: No module named blabla
So, I conclude the the cv
library is not totally hidden. Python is able to see something. Does anybody know what Python is able to see and what is missing?
ADDED
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ADDED 2
In the directory that contains the cv
library there is sub-directory (C:\OpenCV2.2\bin
) with many *.dll
files. So, I tried:
import sys
sys.path.append("C:\OpenCV2.2\bin")
and I still get the "dll开发者_StackOverflow中文版 load failed". Is there a way to find out which exactly "dll" file is missing. I mean, Python tries to find a specific dll file (let say cv.dll) and cannot find it?
In this particular case, "DLL load failed" is caused by using Python 2.6 with OpenCV 2.2. You should use Python 2.7, because cv.pyd is linked with python27.dll.
ImportError can be confusing because it can be thrown when the module you are trying to import tries to import something else and because all of the import code is written in C you don't always get a useful backtrace.
In this case it looks as though either cv itself is a DLL, or some module that it tries to import is a DLL. The DLL won't load because it depends on some other DLL that isn't present on your system.
If you can't easily see what dependency is missing you can try using Microsoft's 'depends' tool to find out.
Most probably Python finds the pure-python module cv, which cannot find a DLL it needs.
精彩评论