经过无数次试错+尝试终于找到了最方便的安装cuda版本的Torch办法,首先可以参考这个文章检查前置条件
(主要是①检查自己的GPU版本②检查cuda驱动是否成功安装)
分别是两个命令
nivida-smi
nvcc --version
都没有问题之后安装清华源的cuda版本的torch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
验证:
python -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"

