臨時使用
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple package-name
注意,simple
不能少, 是 https
而不是 http
設為默認
修改
~
/.config/pip/pip.conf
(Linux)
C:\Users\xxxxx\pip\pip.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