安装torch和torchvision时,两者之间存在依赖关系,版本需要对应起来。这里(https://www.cnblogs.com/lyl0618/p/13323010.html)已经有了些介绍,本文给出更新补充:

torchtorchvisionpython
1.13.11.14.1>=3.7
1.13.01.14.0>=3.7
1.12.01.13.0>=3.7
1.6.00.7.0>=3.6
1.5.10.6.1>=3.5
1.5.00.6.0>=3.5
1.4.00.5.0==2.7, >=3.5, <=3.8
1.3.10.4.2==2.7, >=3.5, <=3.7
1.3.00.4.1==2.7, >=3.5, <=3.7
1.2.00.4.0==2.7, >=3.5, <=3.7
1.1.00.3.0==2.7, >=3.5, <=3.7
<=1.0.10.2.2==2.7, >=3.5, <=3.7
pip install torch-1.13.0+cu116-cp37-cp37m-linux_x86_64.whlpip install torchvision-0.14.0+cu116-cp37-cp37m-linux_x86_64.whl

下载:

  • http://download.pytorch.org/whl/torch/
  • https://download.pytorch.org/whl/torch_stable.html

参考:torch 和torchvision对应关系并附下载路径_torch1.7.0对应torchvision_火星种萝卜的博客-CSDN博客