【发布时间】:2020-08-05 12:37:58
【问题描述】:
我已关注此视频以安装 OpenCV:https://www.youtube.com/watch?v=5pYh1rFnNZs
一切都在 CMake 中成功构建,我使用 Visual Studio 2019 构建和安装文件,一切都很成功。但最后,当我打开命令提示符时,我得到了这个错误:
C:\Users\Ganesh Akshaya>python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python38\lib\site-packages\cv2\__init__.py", line 89, in <module>
bootstrap()
File "C:\Python38\lib\site-packages\cv2\__init__.py", line 79, in bootstrap
import cv2
ImportError: DLL load failed while importing cv2: The specified module could not be found.
>>>
【问题讨论】:
-
你试过用谷歌搜索错误吗?看起来其他几个人也遇到过类似的问题,如 here 所示。
-
是的,即使在人们使用 pip 安装的那个页面中,我也找不到任何解决方案,但在这里我使用 cmake 和 Visual Studio 安装
-
我认为问题出在系统路径上,谁能告诉我我错过了哪个系统路径?
-
我猜:可能是 Visual Studio 构建 cv2 DLL 的路径
-
在 Visual Studio 中构建时,构建的 DLL 的完整路径会打印在构建窗口中。
标签: python visual-studio opencv cmake