Fork me on github

pip换阿里源

在本文中,我们同时配置阿里源、清华源和豆瓣源,进行平衡负载。这里选择清华源作为主源(据说清华源在教育网内会一些;如果是普通的网络,阿里源也挺好用的)。

方法一

这个方法要求pip版本号≥10.0.0。
在命令行中,输入以下命令:

python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python -m pip config set global.extra-index-url "https://mirrors.aliyun.com/pypi/simple/ https://pypi.doubanio.com/simple"

方法二

%APPDATA%目录下,建立pip文件夹,然后在该文件夹下,创建pip.ini文件,内容如下:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
extra-index-url = https://mirrors.aliyun.com/pypi/simple/ https://pypi.doubanio.com/simple

保存即可。

posted @ 2021-10-30 18:06  fang-d  阅读(1727)  评论(0编辑  收藏  举报