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

 

 

posted @ 2022-01-17 17:22  落地成霜  阅读(239)  评论(0编辑  收藏  举报