1. 程式人生 > 其它 >Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificat

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificat

問題描述

cmd 輸入 pip install {包名} 或者 cmd 輸入python -m pip install --upgrade pip 出現如下錯誤:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in vio
lation of protocol (_ssl.c:777)'),)': /simple/pip/

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in vio
lation of protocol (_ssl.c:777)'),)': /simple/pip/

WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in vio
lation of protocol (_ssl.c:777)'),)': /simple/pip/

WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in vio
lation of protocol (_ssl.c:777)'),)': /simple/pip/

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status
=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in vio
lation of protocol (_ssl.c:777)'),)': /simple/pip/

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming
 the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retrie
s exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF occurr
ed in violation of protocol (_ssl.c:777)'),)) - skipping

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming
 the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retrie
s exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF occurr
ed in violation of protocol (_ssl.c:777)'),)) - skipping

網上找了很多方法,下面給出自己最後的解決方法

Step1:

進入cmd ,輸入指令,在C:/user/xx/路徑下建立資料夾,並命名為“pip”

C:\Users\maple>md pip

Step2 :

在該資料夾下面建立一個文字檔案,輸入如下內容,並儲存為名字為“pip.ini”(注意字尾)

[global]

index-url=http://mirrors.aliyun.com/pypi/simple/

[install]

trusted-host=mirrors.aliyun.com

Step3:

配置系統變數Path,在最後新增如下內容(注意和前面內容之間用;隔開):

C:\Users\maple\pip\pip.in;

這一步也就是告訴系統可執行檔案pip.ini的路徑~~~

驗證:

重新輸入 pip install {包名} 成功!!! 如果有更好的解決辦法歡迎各位留言私信提出來 :P ≈