1、anacondahttps://www.anaconda.com/download/success

记得把环境变量和清除缓存勾选上:

Image 5

检测代码:

import torch

if torch.cuda.is_available():
print("PyTorch GPU version is installed and available.")
print(f"CUDA version: {torch.version.cuda}")
print(f"Number of GPUs available: {torch.cuda.device_count()}")
for i in range(torch.cuda.device_count()):
print(f"GPU {i}: {torch.cuda.get_device_name(i)}")
else:
print("PyTorch GPU version is NOT installed or NOT available.")
print("Please check your PyTorch installation, NVIDIA drivers, and CUDA toolkit.")