选择合适的版本
复制命令安装即可
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
检查:
python
import torch
torch.__version__
print (torch.cuda.is_available());
#ture
a = torch.Tensor(5,3)
print(a)
a.cuda()
import torchvision
torchvision.__version__
卸载命令
pip uninstall torch
pip3 uninstall torchvision
安装包在tmp目录下,可以去手动删除