AttributeError: 'module' object has no attribute

python在不同层级目录import模块的方法

#Wrong import
from package import MyEnumClass
# ...
# in some method:
return MyEnumClass.Member


#Correct import:
from package.MyEnumClass import MyEnumClass
#Wrong import
import vilt.modules.vision_transformer as vit

#Correct import
from vilt.modules import vision_transformer as vit

 

 

上一篇:【视频】开发工具第3期:Linux系统搭建设备开发环境全流程(二)


下一篇:AOP-IResourceFilter扩展