Windows下anaconda中安装pytorch

解决anaconda中pytorch安装失败

由于pytorch一般无法直接安装,大多数情况下借助清华镜像来安装。

1.首先打开anaconda的Anaconda Prompt,
在这里插入图片描述

然后分别输入下面的终端命令:

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.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
conda config --set show_channel_urls yes

这一步的目的是将安装源换到清华镜像上。

2.下面就是可以去pytorch官网找好终端下载命令,但有部分改动
在这里插入图片描述

conda install pytorch torchvision cpuonly

需要把-c pytorch去掉,看到有博客说这样就会换到清华镜像上安装。

写这个是当时安装的时候很懵,一步步的都不知道为什么,这个是结合两篇博客综合后自己的理解,如侵权,删。

参考:
解决conda下安装pytorch失败的问题
windows10+Anaconda 安装pytorch(清华镜像)

猜你喜欢

转载自blog.csdn.net/Beings41/article/details/107930377
今日推荐