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

python学习网 2019-08-02 08:44:02

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

1. 更换anaconda源

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

anaconda下载地址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

更换仓库镜像源命令:

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

参考博客:

安装Pytorch0.4.0需要填的坑

阅读(3541) 评论(0)