TypeError: 'module' object is not callable for anaconda when I am trying to import networkx
尝试导入networkx模块时出现此错误
1 2 3 | import networkx as nx G=nx.graph() G.add_node(1) |
堆栈跟踪是
1 2 3 4 5 6 7 | TypeError Traceback (most recent call last) <ipython-input-8-11d4167b2e44> in <module>() 1 from networkx import networkx ----> 2 G=nx.graph() 3 G.add_node(1) TypeError: 'module' object is not callable |
号
当我尝试用Conda根环境在我的Jupyter笔记本上运行它时就会发生这种情况,尽管NetworkX已经安装在该环境中。
您需要使用