Python使用pip安装包时发生SSL报错

 Error:

there was a problem confirming the ssl certificate: httpsconnectionpool(host='pypi.mirrors.ustc.edu.cn', port=443): max retries exceeded with url: /simple/mimesis/ (caused by sslerror(sslcertverificationerror(1, '[ssl: certificate_verify_failed] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))) - skipping

解决方案:

1. 首先运行下面的代码:

pip config set global.extra-index-url http://mirrors.aliyun.com/pypi/simple

运行结果:

 2. 找到上面路径下的文件,使用以下内容覆盖原本pip.ini中的内容

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

[install]
trusted-host = 
	mirrors.aliyun.com
	pypi.douban.com
	pypi.tuna.tsinghua.edu.cn
	pypi.mirrors.ustc.edu.cn
	mirrors.ustc.edu.cn
	mirrors.bfsu.edu.cn
	pypi.hustunique.com

你可能感兴趣的:(python,pip,ssl)