更改源
删除不能用的源,并添加清华源
conda config --remove-key channels
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 --set show_channel_urls yes
执行安装命令
GPU版本:
conda install pytorch torchvision cudatoolkit=10.2
CPU版本:conda install pytorch torchvision cpuonly
默认安装最新版本,可参考官网指定其他版本,如conda install pytorch=1.2.0
注:不要学官网在-c 后加 "pytorch",这是在使用官方通道。
错误写法:conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
如有疑问请在评论区留言,如有帮助麻烦右上角点个赞~0~蟹蟹