pytorch 在conda下载并离线安装

1、安装anconda 2、添加清华镜像 conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ conda config –add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch 3、在线安装 conda install pytorch torchvision torchaudio cudatoolkit=11.1 4、出现y/n时,选择y,然后过一会儿中断 5、下载并本地安装 于Anaconda3\pkgs查看urls.txt文件,得到如: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/pytorch-1.8.0-py3.8_cuda10.2_cudnn7_0.tar.bz2 可进行下载 conda安装此包: conda install –use-local pytorch-1.8.0-py3.8_cuda10.2_cudnn7_0.tar.bz2 conda install –use-local cudatoolkit-10.2.89-hb195166_8.tar.bz2 此步会自动将包拷入到pkgs目录下并解压 到指定的conda 激活环境下,再执行: conda install -c local pytorch cudatoolkit=10.2 即可,如果需要其它包,则对应一一下载