Windows + anaconda + pycharm + nvidia + cuda + cudnn + pytorch installation tutorial

I want to learn pytorch, so I can't install a sub-environment?

View graphics card information

Operation: Start - Right click - Device Manager - Display Adapters.

insert image description here

View cuda version

Operation: NVIDIA in the lower right corner - right click - NVIDIA Control Panel - System Information - Components.

insert image description here

install cuda

Go to the CUDA official website to download the cuda10.2 version.

insert image description here
After downloading, double-click the exe file, change the directory, and decompress it.

insert image description here
After the decompression is complete, it will automatically enter the installation process.

insert image description here
Follow the installation prompts to install by default.

insert image description here

installing.
insert image description here

Check if the installation was successful.

nvcc -V

insert image description here
Success!

install cudnn

Go to the CUDNN official website to download the cudnn corresponding to the cuda10.2 version.

insert image description here
insert image description here
After downloading, unzip and copy the bin, include, and lib files in the CUDNN package directly to the CUDA installation directory (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2).

There will be an admin rights issue here.

insert image description here
Click the checkmark before "Do this for all current projects" and then click Continue.

insert image description here

Configure cuda environment variables

There are already two.
insert image description here
Three more to be added.

The CUDA Samples are not found at first, but the start menu is visible.

insert image description here
Just open it.
insert image description here
Later, it was found that there are bin and libnvvp in the PATH of the system variable.

insert image description here

Configure cudnn environment variables

insert image description here

install pytorch

Check the python version in conda.
insert image description here
Create a virtual environment in conda.

wxm_pytorch is the virtual environment name.

conda create -n wxm_pytorch python=3.7

insert image description here
Click y.

insert image description here

Activate the virtual environment.

conda activate wxm_pytorch

insert image description here

Enter the pytorch official website and select the configuration item.

conda install

insert image description here

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

insert image description here
Enter y and wait for the installation.

insert image description here
Okay.

insert image description here
Wrong.

Delete the failed virtual environment first.

insert image description here
Again.

pip install

insert image description here

pip3 install torch==1.10.2+cu102 torchvision==0.11.3+cu102 torchaudio===0.10.2+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html

It's ready.

insert image description here

have a test:

insert image description here
happy heart.

insert image description here
I saw torch.
insert image description here

first demo

insert image description here
finally! ! !

Guess you like

Origin blog.csdn.net/qq_43779149/article/details/123251209