English | 简体中文
This project offers a concise, step-by-step guide to simplify the process of installing CUDA on Windows.
As AI is currently one of the hottest topics in IT, you might want to try it on your own computer. AI training relies heavily on CUDA, so the first step is to set up the local environment. This project will guide you through configuring CUDA on Windows step by step.
- Press
win+R
, typecmd
to open the terminal, and enternvcc -V
. - If the version information is displayed, CUDA is already installed. Please note the version number after 'release' and proceed to step 3.
- If it displays:
'nvcc' is not recognized as an internal or external command, operable program or batch file
, then CUDA is not installed, and you should proceed to step 2.
- Visit the CUDA download page: NVIDIA CUDA Downloads.
- Select
CUDA Toolkit 12.2.1
, then clickWindows
->x86_64
->11
->exe(local)
. - Click the Download button and wait for it to complete.
- Open the installer, choose 'Express', install all components, and overwrite the current driver with the latest version.
- Note: A brief blackout might occur.
- Use the method from step 1, press
win+R
, typecmd
, and enternvcc -V
. If the version information is displayed, CUDA was installed successfully.
- Visit cuDNN's official page: NVIDIA cuDNN Downloads.
- Download the corresponding CUDA version, e.g., if your CUDA version is 12.2, choose the 12.x version.
- Unzip the downloaded file, rename the folder to
cudnn
, and copy it to the CUDA installation directory.
- Open Path and add the following two lines:
- Visit PyTorch's official website: PyTorch.
- Find the corresponding version and choose conda or pip.
- Run the displayed command, e.g.,
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
. - Please wait patiently for the installation to complete.
If the official website installation fails due to network issues, you can directly download the .whl files from PyTorch Stable.
- Find the three packages corresponding to your local environment:
torch
,torchvision
,torchaudio
. - Use
ctrl+F
and search for your CUDA version number (e.g., for version 11.8, entercu118
) to quickly jump to the corresponding download links. The numbers incpxx
represent your Python version, e.g., if your Python version is 3.11, choose the links containingcp311
. - After downloading the three files, use the terminal's pip command to install:
pip install torch-2.0.0+cu118-cp311-cp311-win_amd64.whl pip install cu118/torchaudio-2.0.2+cu118-cp311-cp311-win_amd64.whl pip install cu118/torchvision-0.15.2+cu118-cp311-cp311-win_amd64.whl