在Debian系统上安装PyTorch,可参考以下步骤:
sudo apt update
。sudo apt install python3 python3-pip
。python3 -m venv pytorch_env
,然后source pytorch_env/bin/activate
。pip install torch torchvision torchaudio
。pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
。conda create -n pytorch_env python=3.8
,然后conda activate pytorch_env
。conda install pytorch torchvision torchaudio cpuonly -c pytorch
。conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch
。安装完成后,可通过import torch
,print(torch.__version__)
和print(torch.cuda.is_available())
验证安装是否成功。