python - 为 Python 2.7 安装 opencv 时出现 DLL Load failed 错误
问题描述
我正在使用 Windows Server 2012 R2 和 Python 2.7,确切地说:
Python 2.7.15(v2.7.15:ca079a3ea3,2018 年 4 月 30 日,16:22:17)[MSC v.1500 32 位(英特尔)] 在 win32 上
最新版本的 OpenCV 库 3.4.2 无法正常工作,并产生以下错误:
>>> import cv2
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv2
File "C:\Python27\lib\site-packages\cv2\__init__.py", line 3, in <module>
from .cv2 import *
ImportError: DLL load failed: The specified module could not be found.
所以我下载了旧版本的 OpenCV 3.4.1,将 cv2.pyd 复制到 C:/Python27/lib/site-packages 并且中提琴它有效!
现在这是我的失败还是他们的失败?我下载了 VC++ x86 Redistributable 2015 和 2017,Python 也是 32 位的,而且我使用的是 32 位版本的 OpenCV lib,所以我认为这不是我的问题,这是怎么回事,有人知道吗?
解决方案
尝试使用 pip 安装?我从来没有遇到过 cv2 的 pip 安装问题。
pip install opencv-python
推荐阅读
- git - Vscode,git diff视图:如何仅显示更改
- python - 试图理解 pandas.DataFrame.mode() 输出形状
- asp.net-core - Blazor:如何从控制器获取 SSRS 的 HTML?
- c# - struct 的泛型重载不调用正确的方法
- java - 我无法将 32 位浮点数或 24 位带符号的 PCM 数据输出到音频系统
- python - 将 PowerShell 输出转换为 Python 并将其存储在变量中
- swift - 如何快速制作水平滚动段
- xml - XPath 规范中的属性选择器(在 SAS 中)
- javascript - Shopify 使用 setCallBack 更改变体价格不起作用
- symfony - 如何在 Doctrine 中正确使用 postUpdate、postRemove、postPersist?