python - 无法使用pip3安装OpenCV

标签 python opencv ssl

当我试图在 Raspberry Pi 上安装 OpenCV 进行对象检测时,出现了这个错误:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available open ssl version -OpenSSL 1.1.0f 25 May 2017 (Library: OpenSSL 1.1.0j 20 Nov 2018)

我正在使用 Python 2.7 作为全局版本并安装了 OpenCV 的所有包。

pip 版本:来自/usr/local/lib/python3.6/site-packages (python 3.6) 的 pip 9.0.1

我使用 pip3 install opencv-python 来安装 OpenCV。

这是错误:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting opencv-python
  Could not fetch URL https://pypi.python.org/simple/opencv-python/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not fetch URL https://www.piwheels.org/simple/opencv-python/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement opencv-python (from versions: )
No matching distribution found for opencv-python

最佳答案

如果不自己构建 OpenCV,则无法在 Raspberry Pi 上安装它。这就是您收到错误 No matching distribution found for opencv-python 的原因。您必须自己在 Raspberry Pi 上构建它。最新版本还使用 Python 3,您将需要使用它,但应该包含在 Rasbian 镜像中。尝试 python3 --version 找出答案。

这里有一个详细的指南,您可以按照它来构建和安装 OpenCV:https://www.learnopencv.com/install-opencv-4-on-raspberry-pi/

上面的网站还有一个脚本,您可以下载并使用它来更轻松地安装它。

关于python - 无法使用pip3安装OpenCV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55713900/

相关文章:

跨不同文件的python多处理

python - OpenCV 错误:函数 cv::drawContours 中的 (-215) npoints > 0

azure - 将 Azure 流量管理器与应用服务 (HTTPS) 结合使用

使用 KSOAP2 和 HTTPS 的 Android 网络服务

python - python中的线平滑算法?

python - 跨多个文件共享 Python 记录器

python - OpenCV calibrateCamera中的对象点和图像点

c# - WCF 客户端证书验证 + Windows 身份验证

python - 当我尝试将数字附加到 Python 中的列表并将该列表发送到 Google Sheets 列时出现错误 'Invalid values[1][0]: list_value'

java - 使用 OpenCv、NDK 和 Android 进行人脸识别