这是我使用的代码:
from P4 import P4, P4Exception
mp = P4.Map()
这是我得到的错误:
为什么? 根据 P4Python 手册,此类方法应该构造一个新的 Map 对象。mp = P4.Map() AttributeError: type object 'P4' has no attribute 'Map'
最佳答案
因为您从 P4.py
导入class P4
。 Map 是 P4.py 中的另一个类。查看源代码:https://github.com/rptb1/p4python/blob/master/P4.py
你应该尝试这个:
import P4
mp = P4.Map()
关于python - P4Python : AttributeError: type object 'P4' has no attribute 'Map' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58324495/