在本文中,我們同時配置阿里源、清華源和豆瓣源,進行平衡負載。這里選擇清華源作為主源(據說清華源在教育網內會一些;如果是普通的網絡,阿里源也挺好用的)。
方法一
這個方法要求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
保存即可。