在CentOS环境下选择PyTorch版本,需注意以下关键因素:
conda install pytorch torchvision torchaudio cpuonly -c pytorch
。conda install pytorch torchvision torchaudio cudatoolkit=your_cuda_version -c pytorch
,将your_cuda_version
替换为实际CUDA版本号。import torch
,再执行print(torch.__version__)
和print(torch.cuda.is_available())
验证安装是否成功及GPU是否可用。