No module named ‘torchvision.models._utils‘

报错:

Traceback (most recent call last):
  File "E:/Code-/jinfeng/detect.py", line 11, in <module>
    from models.retinaface import RetinaFace
  File "E:\Code-\jinfeng\models\retinaface.py", line 4, in <module>
    import torchvision.models._utils as _utils
ModuleNotFoundError: No module named 'torchvision.models._utils'

报错原因是torchvision的版本0.2太低,安装个0.4的就可以的

pip install torchvision==0.4

报错:

Could not find a version that satisfies the requirement torchvision==0.4

以为是版本不兼容的问题,后来查了一下,升级了pip,

 python -m pip install --upgrade pip

就有0.4.1版本了,问题解决
详见:https://blog.csdn.net/weixin_41010198/article/details/103107083

你可能感兴趣的:(深度学习,python相关,日常bug系列)