更改pip install的代理源,提高下载速度。
国内的一些代理源:
阿里云 :http://mirrors.aliyun.com/pypi/simple/
中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
豆瓣:http://pypi.douban.com/simple/
长期修改
设置方法:
cd ~ && mkdir .pip&&cd .pip
touch pip.conf
-
vi pip.conf
写入
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
临时使用:
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent
这样就会从清华这边的镜像去安装gevent库。
注意,目前conda install已经不支持国内的代理源
网友评论