当前位置:   article > 正文

cannot import name ‘int_classes‘ from ‘torch._six‘亲测有效

cannot import name ‘int_classes‘ from ‘torch._six‘亲测有效

问题报错描述

D:\Anaconda3\envs\yolo5\python.exe C:\Users\aw\Desktop\yolov5-alphapose-stgcn\main_ui.py 
Traceback (most recent call last):
  File "C:\Users\aw\Desktop\yolov5-alphapose-stgcn\main_ui.py", line 3, in <module>
    from UI.MainWindows import MainWinddow
  File "C:\Users\aw\Desktop\yolov5-alphapose-stgcn\UI\MainWindows.py", line 10, in <module>
    from video_process import videoprocess
  File "C:\Users\aw\Desktop\yolov5-alphapose-stgcn\video_process.py", line 15, in <module>
    from fn import draw_single
  File "C:\Users\aw\Desktop\yolov5-alphapose-stgcn\fn.py", line 13, in <module>
    from torch._six import string_classes, int_classes
ImportError: cannot import name 'int_classes' from 'torch._six' (D:\Anaconda3\envs\yolo5\lib\site-packages\torch\_six.py)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

解决方案,点击报错的的链接,跳转到fn.py
然后找到【from torch._six import string_classes, int_classes】
把它替换为,也就是替换成下面的两个导入语句,重新运行代码即可解决,如果有用,点个赞呗

from torch._six import string_classes
import collections.abc as int_classes
  • 1
  • 2

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/385082
推荐阅读
相关标签
  

闽ICP备14008679号