cuda以及torch安装

时间:2025-05-07 22:36:56

一、安装cuda
cuda下载(版本11.8.0)

自定义安装可以只安装Cuda Runtime
默认安装目录:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8

二、安装cuDNN
cuDNN下载(版本8.9.7)
将解压的cuDNN压缩包内的三个文件夹(bin、lib、include)复制到CUDA安装目录下

三、torch安装

pip install torch==1.13.1+cu118 torchvision torchaudio -f /whl/torch_stable.html
#pip install --retries=5 torch==1.13.1 torchvision torchaudio --index-url /whl/cu118

四、对应版本onnxruntime安装(若需要)

pip install onnxruntime-gpu==1.17.1
pip install onnxruntime-gpu==1.17.0 --index-url=/onnxruntime/onnxruntime/_packaging/onnxruntime-cuda-12/pypi/simple