First, be careful not to directly use pip install torch, will complain.
Open PyTorch official website: https://pytorch.org/get-started/locally/
The operating system, installed version and installation tools to choose according to their needs, the page will automatically generate the install command, open a command line enter the installation command.
After installation can use the following code debugging
import torch
print(torch.__version__) #torch版本
print('gpu:', torch.cuda.is_available()) #gpu加速是否可用
pip installation tool can refer to blog: https://blog.csdn.net/sinat_40471574/article/details/91354263