背景
用windows复现别人在Linux上的工作时出错。
显示torchvision没有匹配的版本
溯源
在链接: https://download.pytorch.org/whl/torch_stable.html中发现torchvision-0.11.0+cu111没有在windows下的版本,只有linux下的。
cu111/torchvision-0.11.0%2Bcu111-cp36-cp36m-linux_x86_64.whl
cu111/torchvision-0.11.0%2Bcu111-cp37-cp37m-linux_x86_64.whl
cu111/torchvision-0.11.0%2Bcu111-cp38-cp38-linux_x86_64.whl
cu111/torchvision-0.11.0%2Bcu111-cp39-cp39-linux_x86_64.whl
解决
通过查找torch、torchvision和torchaudio的版本对应表,根据自己的cuda和python重新安装。
torch各版本对应关系链接: https://blog.csdn.net/shiwanghualuo/article/details/122860521
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
【cuda版本查看:cmd输入nvidia-smi】
如果提示readtimeout超时,则通过设置超时参数,加长时间
pip --default-timeout=100 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
参考资料
链接: https://blog.csdn.net/weixin_39450145/article/details/126444591