pytorch build Python3.7

Python version: 3.7

1. Install any version of Anaconda

First install anaconda Install anaconda under Windows

Enter the folder, select the corresponding anaconda version, select the following version as python3.7 (if you want to install others, select other version numbers)
Anaconda other version folder

s
After the installation is complete, enter cmd in the search box, open the terminal to see if the installation is successful

Enter python -V
s
Dangdangdangdang~ Version 3.7 is installed successfully
s

2. Configure the graphics card NVIDIA

Open the task manager, ctr+Alt+Del, and see if it is displayed. If it is, it means that the driver already exists. If not, just install the driver.
If you don’t have a GPU, pay attention. If you don’t have one, just omit this step and go directly to step 4.
s

3. Check the cuda version

Open the NVIDIA control panel, how to open it, you can enter NVIDIA in the search box

After opening, select System Information, click Components, and view the corresponding version information.
s
You don't need to manually install CUDA and cuDNN yourself, the official pytorch has done it very well. Just go to the official website and copy the command.

4. Create a pytorch storage warehouse

The reason for creating it is to separate different versions of pytorch for ease of use. Open the anaconda prompt, create a warehouse called mytorch, or call it another name
conda create -n mytorch python=3.7

insert image description here
Then enter y and press Enter

After the installation is complete, enter

conda info --envs
and then enter conda activate mytorch
to activate the current environment and enter the warehouse just created
s

5. Install pytorch

Enter the pytorch official website
, pull down to see the page, and select the corresponding pytorch version number according to the version of your computer. The CUDA version
supported by my computer is 11.1.114.

注意,前面没有GPU的这里直接选择CPU即可,不需要再去安装什么CUDA了

s
Enter the corresponding command in the command line just now

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge

s
Enter y and press Enter, wait patiently, it will look like this after completion
s

6. Verify

Next is the verification moment, as shown in the figure below, the installation is successful

#先输入
python
#再输入
import torch
#然后输入
import torchvision
#最后输入
torch.cuda.is_available()

s

Guess you like

Origin blog.csdn.net/qq_43738932/article/details/123914869