conda安装Pytorch下载过慢解决办法(11月26日更新ubuntu下pytorch1.3安装方法)

目录

添加清华源

安装PyTorch

3月5日更新ubuntu下pytorch1.0.1安装方法(Ubuntu16.04+CUDA9.0+PyTorch1.0.1)

7月23日更新ubuntu下pytorch1.1安装方法(通过pip)

11月26日更新ubuntu下pytorch1.3安装(通过conda)

如何查看能不能用清华源加速你的pytorch安装


pytorch最近已经更新到了稳定版本的1.0.1,从Pytorch官网上可以看到有多种安装方式:

比较常见的方法是通过pip和conda安装,当使用conda安装的时候,可能会遇到下载过慢的问题,尤其是文件:pytorch-1.0.1-py3.6_cuda90_cudnn7_1.tar.bz2,下载的时候可能会遇到无尽的等待。这里推荐用清华源替代默认conda源的方法,可以解决下载过慢的问题。

清华conda源地址:https://mirrors.tuna.tsinghua.edu.cn/help/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

另外为了保险起见,建议同时添加第三方conda源:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

安装PyTorch

根据Python和CUDA选择对应的版本,然后官方给出提示可通过运行:

conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
但是这里一定要注意,去掉-c pytorch,安装的时候才会默认从清华源下载相应的包,因此这里用命令行:

conda install pytorch torchvision cudatoolkit=9.0

接着等待安装成功就好了(注意到画红框的部分已经默认源替换为tsinghua源了)。

最后可以通过命令行验证一下,可以看到已经正确安装PyTorch1.0.

评论 75
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值