Appearance
pip的使用
网络代理
临时设置
pip install --proxy=http://192.168.30.12:7890 torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html设置源
pip有默认的源,国内因为有墙的存在,导致下载包缓慢,因此需要设置国内的源以提升下载速度。 以设置清华源为例。
临时设置
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package永久设置(pip>=10.0.0)
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple配置多个镜像源
配置多个镜像源平衡负载,可在已经替换 index-url 的情况下通过以下方式继续增加源站:
pip config set global.extra-index-url "<url1> <url2>..."查看源
pip config list这将列出所有的pip配置,包括源。你可以在输出中查找global.index-url来找到配置的源。
删除源
pip config unset global.index-url查看某个包的可用版本
pip index versions <包名>查看已安装包的版本
pip show <包名>pip升级
python -m pip install --upgrade pip