问题描述
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 ≈