参考:cannot import name ‘PY3‘ from ‘torch._six‘解决方法
报错:ImportError: cannot import name ‘PY3’
原因:torch和torchvision的版本不匹配
解决:选择合适的版本重新安装torchvision
torchvisin与torch版本对应关系:https://github.com/pytorch/vision#installation
附:
torch | torchvision | python |
---|---|---|
1.9.0 | 0.10.0 | >=3.6 |
1.8.1 | 0.9.1 | >=3.6 |
1.8.0 | 0.9.0 | >=3.6 |
1.7.1 | 0.8.2 | >=3.6 |
1.7.0 | 0.8.1 | >=3.6 |
1.7.0 | 0.8.0 | >=3.6 |
1.6.0 | 0.7.0 | >=3.6 |
1.5.1 | 0.6.1 | >=3.5 |
1.5.0 | 0.6.0 | >=3.5 |
1.4.0 | 0.5.0 | ==2.7, >=3.5, <=3.8 |
1.3.1 | 0.4.2 | ==2.7, >=3.5, <=3.7 |
1.3.0 | 0.4.1 | ==2.7, >=3.5, <=3.7 |
1.2.0 | 0.4.0 | ==2.7, >=3.5, <=3.7 |
1.1.0 | 0.3.0 | ==2.7, >=3.5, <=3.7 |
<=1.0.1 | 0.2.2 | ==2.7, >=3.5, <=3.7 |