PyTorch对Debian系统的安装和使用有以下特殊要求和步骤:
安装Python和pip:
sudo apt update
sudo apt install python3 python3-pip
编译安装依赖包:
build-essential libssl-dev libffi-dev zlib1g-dev 等。sudo apt install build-essential libssl-dev libffi-dev zlib1g-dev
使用pip安装PyTorch:
pip3 install torch torchvision torchaudio
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
安装完成后,可以通过以下命令验证PyTorch是否安装成功:
import torch
print(torch.__version__)
print(torch.cuda.is_available()) # 如果安装了CUDA版本,应该返回True
综上所述,PyTorch在Debian上的安装过程与在其他Linux发行版上类似,但需要额外注意CUDA版本的兼容性和依赖项的安装。