原因
国内使用官方的pypi源不稳定,经常出现timeout的情况,所以使用阿里的源代替
方法
- 新建配置文件
Window下:
%APPDATA%\pip\pip.ini
Linux下:
~/.pip/pip.conf
- 内容
[global]
timeout = 60
index-url = http://mirrors.aliyun.com/pypi/simple/ - 如果使用
http
链接,则需要trusted-host
参数
[global]
timeout = 60
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com
现在可以顺畅使用pip了