Anaconda中安装Pytorch 速度太慢解决办法

一、问题

在Anaconda中新建环境后,想在GUI上直接安装Pytorch,但是速度特别慢。

在这里插入图片描述

二、解决方法

1.点击环境右侧的箭头,打开当前环境的终端

在这里插入图片描述
2. 添加镜像

在弹出来的终端窗口中添加镜像网址,输入的代码如下:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
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 --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
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/fastai/

示例:
在这里插入图片描述

3. Pytorch资源下载命令行

Pytorch官网,根据Python和CUDA选择对应的版本进行选择,得到命令行

在这里插入图片描述
但是一定要去掉-c pytorch,安装的时候才会默认从镜像源下载相应的包,因此这里用命令行:

conda install pytorch torchvision cudatoolkit=10.1

4. 检查命令行中窗口中,下载使用的是否是镜像源

在这里插入图片描述
如果发现来源是default,说明还是用的conda自己的源,速度还是慢。需要修改源

5.修改下载源

用everything找到conda的.condarc配置文件

在这里插入图片描述
将配置文件中通道channels下的“-defaults”去掉,防止使用默认源。

在这里插入图片描述
6.再次运行下载命令,检查所有包的源都是来自镜像就正常下载

在这里插入图片描述

三、PS

  1. 直接去清华源下载离线的安装包,网址是Pytorch下载

  2. 从Anacodna的官网直接下载Pytorch下载

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值