官网安装指南:https://pytorch.org/get-started/locally/

1. Linux

Language Package CUDA Command
Python pip 9.2 pip install torch==1.7.1+cu92 torchvision==0.8.2+cu92 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
10.1 pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
10.2
11.0 pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
None pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
conda 9.2 conda install pytorch torchvision torchaudio cudatoolkit=9.2 -c pytorch
10.1 conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch
10.2 conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
11.0 conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch
None conda install pytorch torchvision torchaudio cpuonly -c pytorch

1.2 Windows