【python错误解决】 AttributeError: module ‘networkx‘ has no attribute ‘Graph‘

使用networkx库

创建无向图,使用函数
import networkx as nx
G=nx.Graph()

出现错误: AttributeError: module ‘networkx’ has no attribute ‘Graph’

解决办法:
在python安装包中的site-packages文件夹中(作者的文件路径:C:\Users\Anaconda3\Lib\site-packages),将整个networkx文件夹拷贝致运行程序所在的文件夹,方可正确运行。

猜你喜欢

转载自blog.csdn.net/weixin_41824534/article/details/108422641