PyTorch在Debian上支持GPU加速,需手动配置CUDA和cuDNN,具体如下:
dpkg
安装。pip install torch --index-url https://download.pytorch.org/whl/cu118
(对应CUDA 11.8)。import torch; print(torch.cuda.is_available())
,输出True
表示配置成功。注:Debian 11及以上版本支持CUDA,需确保驱动、CUDA、cuDNN版本匹配,建议参考PyTorch官网生成安装命令。