属性错误:AttributeError: module 'xxx' has no attribute 'xxx' - ouyuming/AiLearn GitHub Wiki

一、属性错误逻辑梳理

  • (一)报错特征
  1. 控制台报错:AttributeError: module 'xxx' has no attribute 'xxx'
  2. 关联报错:Cannot find reference 'xxx' in 'init.py'
  • (二)图片示例
  1. 示例1:

AttributeError: module 'torchvision' has no attribute 'CIFAR10'

Cannot find reference 'CIFAR10' in 'init.py' 两种错误合并

  1. 示例2:

AttributeError: module 'concurrent' has no attribute 'futures'

Cannot find reference 'futures' in 'init.pyi'

  • (三)总结原因与解决方案逻辑梳理
  1. 总结版:同名或包缺失

https://blog.csdn.net/weixin_35737303/article/details/80203586

  1. 该模块缺乏该包
  2. 脚本名字与脚本中引入的包名重合

https://blog.csdn.net/weixin_45189629/article/details/101270030

https://blog.csdn.net/gaifuxi9518/article/details/81038019

https://blog.csdn.net/qq_37465638/article/details/102094536

  1. 关联错误解决方案(执行后没效果)

https://blog.csdn.net/feiyihexin/article/details/87193109

二、真正问题:自己打错代码!!!

  • (一)问题描述
  1. 路径打错,缺少dataset,导致编译器找不到路径
  2. 图片展示