我的猜测是,这很可能是由于循环导入引起的。
from binarytree import build
n = build([4,5,3,7,8,2,1])
print(n)
错误:-
Traceback (most recent call last):
File "d:\ml and ai in python\binarytree.py", line 1, in <module>
from binarytree import build
File "d:\ml and ai in python\binarytree.py", line 1, in <module>
from binarytree import build
ImportError: cannot import name 'build' from partially initialized module 'binarytree' (most likely due to a circular import) (d:\ml and ai in python\binarytree.py)