本章教程,介绍如何安装PyTorch,介绍两种安装方式,一种是通过pip直接安装,一种是通过conda方式安装。

一、查看CUDA版本

二、安装PyTorch
1、pip安装方式
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu116
2、conda安装方式
需要先创建一个虚拟环境
conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c p