5

anaconda笔记:解决conda无法下载pytorch的问题

 2 years ago
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.
neoserver,ios ssh client
anaconda笔记:解决conda无法下载pytorch的问题 | 高深远的博客

anaconda笔记:解决conda无法下载pytorch的问题

发表于 2020-02-22 | 更新于: 2020-02-26 | 分类于 环境配置 | 0 | 阅读次数:
字数统计: 356字 | 阅读时长 ≈ 1分钟

今天想加一个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删去。


碰到底线咯 后面没有啦

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK