我想在 Windows 10 上安装带有 contrib 模块的 OpenCV 3,并将其与 Python 2.7(32 位)一起使用。我认为在 opencv 中拥有 contrib 模块的唯一方法是编译它。 (不使用 *.exe 安装)。
我用 contrib 模块编译 OpenCV 没有问题。我使用了 Visual Studio 2013,在 Release模式下编译(适用于 Win32)。
编译OpenCV后,我可以在$PYTHON_HOME/Libs/site-packages
中看到“cv2.pyd”模块
问题:
当我尝试在 Python IDLE 中import cv2
时出现此错误:
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
如您所见,我有一个 32 位 Python。此外,该模块被“检测到”。
有什么问题?
最佳答案
我发现了问题。
我必须将 OpenCV *.dll 添加到 PATH 环境变量。这个 *.dll 在
$OPENCV_HOME/bin/release
关于python - 使用 Visual Studio 2013 在 Windows 10 上为 Python 编译 OpenCV wit contrib 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33423059/