anaconda笔记:解决conda无法下载pytorch的问题
source link: https://gsy00517.github.io/anaconda20200222000018/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
anaconda笔记:解决conda无法下载pytorch的问题
今天想加一个pytorch的新环境,无奈墙太厚,家里的网根本下载不下来,torch和torchvision两个包的进度始终只有0,网速下行也一直是0。在修改成清华镜像(目前国内唯一能用的,别的要么无法访问要么重定向)之后,还是没能成功。后来在网上找到了一种直接编译的方法,当然最后我没用,在理解了conda的命令操作后,我终于解决了这个问题。
由于在安装pytorch的时候,我直接到官网里配置之后copy下来的,其命令如下:
conda install pytorch torchvision cpuonly -c pytorch
后来我才发现,最后的-c pytorch
的作用是指定pytorch源作为channel来下载,这里指定的优先级比~/.condarc
里设置的镜像源要高。
于是我去掉指定,调整如下:
conda install pytorch torchvision cpuonly
于是很快就用清华镜像下载好了。我这里下载的是无cuda版本,其他的一样。
添加清华源的方法
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 --set show_channel_urls yes
或者直接vim ~/.condarc
编辑,按i
修改内容,再按ESC
退出insert模式回到normal模式,最后使用:wq
保存并退出。
注意:可以把
~/.condarc
里的- default
删去。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK