pip 源相关
一、清华源
tsinghua
1、临时使用
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
3、更新pip
pip install -U pip -i https://pypi.tuna.tsinghua.edu.cn/simple
4、设置默认
pip install pip -U -i https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
5、写入配置文件
mkdir -p ~/.pip/
tee > ~/.pip/pip.conf <<EOF
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
EOF
二、阿里源
aliyun
1、临时使用
pip install -i https://mirrors.aliyun.com/pypi/simple some-package
3、更新pip
pip install -U pip -i https://mirrors.aliyun.com/pypi/simple
4、设置默认
pip install pip -U -i https://mirrors.aliyun.com/pypi/simple
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
5、写入配置文件
mkdir -p ~/.pip/
tee > ~/.pip/pip.conf <<EOF
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
EOF
三、中科大
ustc
pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple package
四、其他
pip config get global.cache-dir
pip config set global.cache-dir /hl/pip_cache
pip install --download-cache https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp310-cp310-linux_x86_64.whl
pip install --download-directory="$PIP_SDIST_INDEX" <package>