python修改源

修改python源

python默认的源比较缓慢所以我们需要修改

临时使用

修改源
1
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

simple不可缺少,使用HTTPS

设置为默认更新源
升级pip至新版本(>=10.0.0)

1
2
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

可以先通过临时的源升级pip

1
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U