报错原因:默认从国外镜像源下载,而从国外下载速度极慢,导致报错
解决办法:使用清华镜像,下面是添加清华镜像至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
然后在pytorch官方上使用官方提供的下载命令进行下载
此时可能依旧会报错,因为使用conda install pytorch torchvision cpuonly -c pytorch此命令,其中-c pytorch参数指定了conda获取pytorch的channel,在此指定为conda自带的pytorch仓库。
因此,只需要将-c pytorch语句去掉,就可以使用清华镜像源快速安装pytorch了。【亲身经历,安装了三天,才发现原来问题出在这!!!】