标签:partial mod lang named 调试 imp 时报 mmu com
本来代码能正常运行,后来将文件名修改为networkx.py
代码中含有
import networkx as nx
from networkx.algorithms import community
G = nx.read_graphml(graphml)
运行时报错如下:
ModuleNotFoundError: No module named ‘networkx.algorithms‘; ‘networkx‘ is not a package
胡乱调试一通后报错
AttributeError: partially initialized module ‘networkx‘ has no attribute ‘read_graphml‘ (most likely due to a circular import)
看到第二个报错说很可能是循环引入想起自己的文件名与包名一样,可能会引起错误(自己导入自己?)
将文件名修改后正常运行
标签:partial mod lang named 调试 imp 时报 mmu com
原文地址:https://www.cnblogs.com/jeff-56/p/14952578.html