其他分享
首页 > 其他分享> > AttributeError: 'module' object has no attribute

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

 

 

标签:transformer,MyEnumClass,attribute,object,vit,vilt,import,AttributeError,Correct
来源: https://www.cnblogs.com/ldcs/p/15814345.html