pip install时报以上错误。
问题原因:从执行的过程来看,请求一直处于超时。这是由于国内很多情况下,无法正常去下载国外服务器资源导致。
解决方案:使用国内镜像,常用的有镜像有
- 清华大学镜像:https://pypi.tuna.tsinghua.edu.cn/simple/
- 阿里云:https://mirrors.aliyun.com/pypi/simple/
- 中科大镜像:https://pypi.mirrors.ustc.edu.cn/simple/
- 豆瓣镜像:https://pypi.douban.com/simple/
- 中科大镜像2:https://pypi.mirrors.ustc.edu.cn/simple/
举例:例如安装requests模块
# 示例如下: pip install requests -i https://mirrors.aliyun.com/pypi/simple/
注意:如果安装过程中提示需要升级pip
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
# 解决命令
python -m pip install --upgrade pip -i http://mirrors.aliyun.com/pypi/simple/