目录

2019-07-19-Python配置清华镜像源

Python配置清华镜像源

Python配置清华镜像源

1.前言

使用pip 安装服务器在国外的python 库时,下载需要很长时间,在配置文件中设置国内镜像可以提高速度,清华镜像源就是其中之一。

2.pypi 镜像使用帮助

网址:https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

3.临时配置

若只是临时下载一个python库的话,则可使用以下命令进行配置:

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

conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/   # 这是安装Pytorch的镜像路径

说明:“some-package”为要下载的python库名(或称作包名)。

4.默认配置(永久配置)

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

说明:

(1)“pip install pip -U”是用于执行升级pip的命令;

(2)若pip为10.0.0以上版本,则可以进行升级;

(3)查看pip版本的命令:pip -V

687474:70733a2f2f626c6f672e6373646e2e6e65742f74776f5f7965:2f61727469636c652f64657461696c732f3936343832353535