pip install torch

It is different from install torch with anaconda, there is a way to install torch with python.

https://download.pytorch.org/whl/torch_stable.htmlicon-default.png?t=N7T8https://download.pytorch.org/whl/torch_stable.htmlOpen this page, then download the whl file that you need.

For example, I choose three files named 

                torch-1.12.0+cu116-cp39-cp39-win_amd64.whl

                torchvision-0.13.0+cu116-cp39-cp39-win_amd64.whl

                torchaudio-0.12.0+cu116-cp39-cp39-win_amd64.whl 

You should pay attention to the num.

Input the nvidia-smi you can see the version of your cuda.

Find the right version of torch and the correct version of torchvision. There I choose cp39 because my python.version is 3.9. So you can choose 3.10 if your python.version is 3.10.

---------------------------------------------------

torch         torchvision      python
main/nightly    main/nightly    >=3.7,<=3.10
1.13.0    0.14.0    >=3.7,<=3.10
1.12.0    0.13.0    >=3.7, <=3.10
1.11.0    0.12.0    >=3.7, <=3.10
1.10.2    0.11.3    >=3.6, <=3.9
1.10.1    0.11.2    >=3.6, <=3.9
1.10.0    0.11.1    >=3.6, <=3.9
1.9.1    0.10.1    >=3.6, <=3.9
1.9.0    0.10.0    >=3.6, <=3.9
1.8.2    0.9.2    >=3.6, <=3.9
1.8.1    0.9.1    >=3.6, <=3.9
1.8.0    0.9.0    >=3.6, <=3.9
1.7.1    0.8.2    >=3.6, <=3.9
1.7.0    0.8.1    >=3.6, <=3.8
1.7.0    0.8.0    >=3.6, <=3.8
1.6.0    0.7.0    >=3.6, <=3.8
1.5.1    0.6.1    >=3.5, <=3.8
1.5.0    0.6.0    >=3.5, <=3.8
1.4.0    0.5.0    ==2.7, >=3.5, <=3.8
1.3.1    0.4.2    ==2.7, >=3.5, <=3.7
1.3.0    0.4.1    ==2.7, >=3.5, <=3.7
1.2.0    0.4.0    ==2.7, >=3.5, <=3.7
1.1.0    0.3.0    ==2.7, >=3.5, <=3.7
<=1.0.1    0.2.2    ==2.7, >=3.5, <=3.7

torch            torchaudio          python

main / nightly main / nightly >=3.7, <=3.10

1.12.0          0.12.0           >=3.7, <=3.10

1.11.0          0.11.0           >=3.7, <=3.9

1.10.0         0.10.0          >=3.6, <=3.9

1.9.1           0.9.1           >=3.6, <=3.9

1.9.0           0.9.0           >=3.6, <=3.9

1.8.2           0.8.2           >=3.6, <=3.9

1.8.1          0.8.1           >=3.6, <=3.9

1.8.0           0.8.0          >=3.6, <=3.9

1.7.1           0.7.2          >=3.6, <=3.9

1.7.0           0.7.0           >=3.6, <=3.8

1.6.0           0.6.0          >=3.6, <=3.8

1.5.0           0.5.0          >=3.5, <=3.8

1.4.0           0.4.0           ==2.7, >=3.5, <=3.8

----------------------------------------------------------------

These are the versions you could shudy.

You could open the cmd of your folder that you just download these files, then input your command.

pip install torch-1.12.0+cu116-cp39-cp39-win_amd64.whl torchvision-0.13.0+cu116-cp39-cp39-win_amd64.whl torchaudio-0.12.0+cu116-cp39-cp39-win_amd64.whl

There I just install like this:

Test it:

import torch
print(torch.__version__)
torch.cuda.is_available()

猜你喜欢

转载自blog.csdn.net/m0_72572822/article/details/132783328