繁体   English   中英

“在安装 opencv package 时,确认 ssl 证书时出现问题...”

[英]" There was a problem confirming the ssl certificate..." while installing opencv package

嗨,这是我第一个问题的延续。我是 python 的初学者,试图在 Mac M1 上使用人脸识别和 opencv 库创建人脸识别项目。 我使用正确的 arm64 配置创建了一个新的 Conda 环境:

CONDA_SUBDIR=osx-arm64 conda create -n openCVTest python=3.9 -c conda-forge --override-channel

我激活了环境并做了:

conda install -c conda-forge opencv
conda install -c conda-forge face_recognition

我可以在 pip 列表中看到 face_recognition,但是我的代码在导入时仍然有错误。 对于 opencv,我在执行 pip 列表时没有看到安装的库,所以我尝试这样做:

pip install opencv

但它给了我这个错误:

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv/
Could not fetch URL https://pypi.org/simple/opencv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/opencv/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

我不知道我的 pip 是否有问题,或者是我设置的环境无法正常运行,我非常感谢有关如何解决此问题的任何帮助。提前致谢。

这是您解决问题的线索:

“无法连接到 HTTPS URL,因为 SSL 模块不可用。”

所以你的 SSL 模块丢失了。 如果您在没有必要依赖项的情况下从源代码编译 python,或者在相同条件下在 anaconda 等其他一些 python 环境中编译 python,则可能会发生这种情况。

从 python 和 ssl 安装必要的软件包。 如果您在 debian/ubuntu 系统上,这将是:

sudo apt-get install libssl-dev

如果你在 redhat/centos/rocky:

sudo yum install openssl

对于任何其他系统,请为 OpenSSL 找到安装 package。 在 windows 上,确保以下文件位于..\Anaconda\DLLs..\Anaconda\Libarary\bin

libcrypto-1_1-x64.*
libssl-1_1-x64.*

处理好 SSL 的必要依赖项后,重建您的虚拟环境。 如果这不能解决您的问题(无论如何在 unix 上),请考虑重建或重新安装 anaconda。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM