当我试图在 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/