打开Anaconda Propmt
在命令行里面输入如下命令:
创建pytorch-gpu虚拟空间

conda create -n pytorch-gpu python=3.7 -y

切换到pytorch-gpu空间

conda activate pytorch-gpu

为了使得安装快速,需要添加清华源

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --set ssl_verify false

在如下页面(https://pytorch.org/)上获取安装命令:
在这里插入图片描述

安装
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

安装完以后,如下:代表安装成功
在这里插入图片描述

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐