Python中pip的SSL异常

使用python中的pip安装一些组件,都报错,与 SSL有关:

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:504: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/

解决方案

(1)在系统目录C:Users用户AppDataRoaming新建pip文件夹;

(2)在pip文件夹下新建pip.ini文件,并写入如下配置:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

 

一些国内的pip安装源:

阿里云 http://mirrors.aliyun.com/pypi/simple/ 

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 

豆瓣http://pypi.douban.com/simple/ 

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 

中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

切换了国内的安装源,安装就正常了。

原文地址:https://www.cnblogs.com/liweis/p/13089699.html