?以前寫了一篇文章,不過不是專門為了解決這個問題的,但是不能訪問pip install 不能安裝來自https 協議的包問題幾乎每次都出現,之前解決方案只是治標不治本
https://blog.csdn.net/wangsenling/article/details/130194456???????https://blog.csdn.net/wangsenling/article/details/130194456根本原因在于,你用conda安裝不同版本的python時,如果沒指定配套的openssl版本,那么python就會默認使用你系統安裝的openssl版本
因為你安裝conda的時候,conda默認使用python12版本作為默認引擎,而python12使用的openssl版本較高,導致你創建一個python3.8版本時,就會報錯
(venv) D:\pycharmProjects\whatsapp-desktop-api>pip3 install -r requirements.txt
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/aiofiles/
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/aiofiles/
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/aiofiles/
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/aiofiles/
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/aiofiles/
解決方案
conda在創建python版本時,指定openssl對應版本,例如python3.8使用1.1.1,這樣就創建了一個py38版本,且使用的是openssl=1.1.1版本的
conda create -n py38 python=3.8 openssl=1.1.1
?這時你在cmd下輸入openssl 和 在pycharm激活環境下查看是不同的,證明相互之間不會互相干擾
CMD下
?Pycharm 下的python38環境下是 1.1.1版本,目前安裝時,已經不再報ssl錯誤了,這才終極解決之道。