经常要通过pip install安装需要的包,但是每当下载的文件比较大时,网速不够快,会导致报错。所以采用清华源来加速 清华大学开源软件镜像站 https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ ①临时使用: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package (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://www.cnblogs.com/fragrant-breeze/p/12244632.html