python安装第三方库--换镜像源

1. 更换anaconda源

清华大学镜像:清华大学镜像

更换仓库镜像源命令:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --set show_channel_urls yes

2. 更换pip源

在python安装目录的bin目录下运行命令:

cd ~/.pip

如果不存在该文件夹则:

mkdir ~/.pip

cd ~/.pip

touch pip.conf

vim pip.conf

在pip.conf中添加如下内容:

[global]

index-url = http://mirrors.aliyun.com/pypi/simple/

[install]

trusted-host=mirrors.aliyun.com

保存即配置好了pip镜像源。

3. 以下载pytorch0.4.0为例

sudo pip install torch==0.4.0 -f https://download.pytorch.org/whl/cu90/stable

运行上述命令即可快速下载pytorch0.4.0

参考博客:

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐