使用pip指令安装包,报错如下:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'))': /simple/xlrd/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'))': /simple/xlrd/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'))': /simple/xlrd/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'))': /simple/xlrd/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'))': /simple/xlrd/
Could not fetch URL https://pypi.org/simple/xlrd/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/xlrd/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)'))) - skipping
ERROR: Could not find a version that satisfies the requirement xlrd
ERROR: No matching distribution found for xlrd

如图所示:

找了很多资料,最后解决方案如下:

1.创建pip文件夹

2.在pip文件夹下创建pip.ini

pip.ini内容如下,可直接复制:

[global]

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

[install]

trusted-host=mirrors.aliyun.com

3.配置CLASSPATH系统环境变量:;%HOMEPATH%\pip\pip.in

4.再次使用pip install XXX安装,成功!

 posted on 2021-03-25 19:57  叶叶酱  阅读(1036)  评论(0编辑  收藏  举报