pip安装requests时报https/tls/ssl错误

作者: 孙凯 分类: 系统运维 发布时间: 2021-09-01 11:02

pip安装requests时报错,提示如下:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available
.",)) - skipping

经过多次测试,发现是url的来源的问题,换成了国内的pip源就可以正常安装了,我使用的是:

pip3 install requests -i http://pypi.douban.com/simple –trusted-host pypi.douban.com

还可以使用以下地址

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

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

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

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

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

发表回复