更改源
刪除不能用的源,並添加清華源
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~蟹蟹