pytorch版本需要和cuda版本相适应,所以首先查看自己电脑的cuda版本
(10条消息) CUDA学习(一)——如何查看自己CUDA版本?_溪午不闻钟_的博客-优快云博客_cuda version
通过以下命令行安装对应版本的pytorch
pip --default-timeout=1000 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html