pip源配置国内源

有时使用pip安装东西,特别慢,我们可以将默认的pip源换成国内的源,如清华、豆瓣的pip源,相比国外源会快很多。
临时使用
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
注意,simple 不能少, 是 https 而不是 http
 
设为默认
修改 ~/.config/pip/pip.conf (Linux), %APPDATA%\pip\pip.ini (Windows 10) 或 $HOME/Library/Application Support/pip/pip.conf (macOS) (没有就创建一个), 修改 index-url至tuna,例如
 
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
pip 和 pip3 并存时,只需修改 ~/.pip/pip.conf。
 
如果以上不能用,请参考清华开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
posted @ 2017-09-08 13:57  yangrz  阅读(263)  评论(0编辑  收藏  举报