i激活了环境并做到了:
conda install -c conda-forge opencv
conda install -c conda-forge face_recognition
我可以在PIP列表中看到face_recognition,但是导入时我的代码仍然存在错误。对于openCV,我没有看到列出列表时安装了库,所以我尝试这样做:
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是否有问题,还是我设置的环境无法正常运行,我真的很感谢您对如何解决此问题的任何帮助。
这是您解决问题的线索:
因此,您的SSL模块丢失了。如果您在没有必要的依赖项的情况下或在其他某些Python环境(如Anaconda)中收集Python,则可能发生这种情况。
安装了Python和SSL的必要包装。如果您正在使用Debian/Ubuntu系统,这将是:
sudo apt-get install libssl-dev
如果您在redhat/centos/rocky上:
sudo yum install openssl
对于任何其他系统,请为OpenSSL找到安装软件包。在Windows上,确保以下文件在
..\Anaconda\DLLs
和
..\Anaconda\Library\bin
中::
libcrypto-1_1-x64.*
libssl-1_1-x64.*
SSL的必要依赖项需要照顾,重建您的虚拟环境。如果这无法解决您的问题(无论如何),请考虑重建或重新安装Anaconda。