問題描述
執行pip install 發現以下報錯:
Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))) - skipping
看報錯描述,猜測是https證書校驗問題,最簡單的解決方案是使用http鏡像地址,步驟如下:
1、創建pip組態檔
查看組態檔路徑:
C:\Users\Loren\PycharmProjects\pythonProject\venv\Scripts>./pip.exe -v config list
For variant 'global', will try loading 'C:\ProgramData\pip\pip.ini'
For variant 'user', will try loading 'C:\Users\EchatDev\pip\pip.ini'
For variant 'user', will try loading 'C:\Users\EchatDev\AppData\Roaming\pip\pip.ini'
For variant 'site', will try loading 'c:\users\echatdev\pycharmprojects\pythonproject\venv\pip.ini'
命令會輸出各個級別的pip組態檔路徑,這里選擇全域配置'global',找到C:\ProgramData\pip\pip.ini檔案,如果沒有則創建,
2、配置鏡像地址
打開pip.ini,添加鏡像配置:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
這里使用的阿里云的鏡像地址,相對速度比較快,需要添加trusted-host,
配置完成之后,重新執行pip install即可成功,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/255221.html
標籤:python
