问题描述
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 violation 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 violation 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 violation 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 violation 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 violation of protocol (_ssl.c:777)'),)': /simple/pip/Could not fetch URL /simple/pip/: There was a problem confirmingthe ssl certificate: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:777)'),)) - skippingCould not fetch URL /simple/pip/: There was a problem confirmingthe ssl certificate: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred 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=/pypi/simple/[install]trusted-host=
Step3:
配置系统变量Path,在最后添加如下内容(注意和前面内容之间用;隔开):
C:\Users\maple\pip\pip.in;
这一步也就是告诉系统可执行文件pip.ini的路径~~~
验证:
重新输入 pip install {包名} 成功!!! 如果有更好的解决办法欢迎各位留言私信提出来 :P ≈