找了好多解决方法,都始终报错,终于解决了,传送门:python 3.x - AttributeError: module 'networkx.algorithms.community' has no attribute 'best_partition' - Stack Overflow
评论里面能够解决我的问题的是下面这段代码
先导入模块
pip uninstall community
之后用下面的代码,就可以解决啦!!!
import community.community_louvain as cl
partition = cl.best_partition(G_fb)