pip清华镜像源使用方法总结

临时使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple package-name

注意,simple 不能少, 是 https 而不是 http

设为默认

修改

 ~/.config/pip/pip.conf (Linux)

 C:Usersxxxxxpippip.ini (Windows 10)

 $HOME/Library/Application Support/pip/pip.conf (macOS)

(没有就创建一个)

修改 index-url

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

pip 和 pip3 并存时,只需修改 ~/.pip/pip.conf

或者终端输入

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
原文地址:https://www.cnblogs.com/SakuraYuki/p/13341457.html