且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法在OpenCV2.1上导入简历

更新时间:2021-09-04 08:29:40

似乎找不到OpenCV DLL.您是否将OpenCV的bin目录添加到您的PATH"C:\OpenCV2.1\bin"中?

The OpenCV DLLs seem not to be found. Did you add OpenCV's bin directory to your PATH, "C:\OpenCV2.1\bin" in your case?

使用Python包装器

To use the Python wrappers

sys.path.append("C:\OpenCV2.1\Python2.6\Lib\site-packages")
import cv

应该起作用,并将cv.libcv.pyd复制到您的C:\Python26\Lib\site-packages(假设您已将Python安装到C:\Python26).

should work, as well as copying cv.lib and cv.pyd to your C:\Python26\Lib\site-packages (assuming you installed Python to C:\Python26).

但是那些包装器必须找到应该包装的DLL.因此,请确保它们在Python可以找到它们的路径中.

But those wrappers have to find the DLLs they should wrap. So make sure, they are in a path Python can find them.

也许这个问题在Windows 7上为Python 2.7安装OpenCV 可能会有所帮助,尤其是 Gia Thuy的他在回答中提到的日记帖子.尽管他使用Python 2.7和OpenCV 2.2,但过程仍然相同.

Maybe this question Installing OpenCV on Windows 7 for Python 2.7 may help, especially Gia Thuy's journal post he mentions in his answer. Although he uses Python 2.7 and OpenCV 2.2, the procedure remains the same.