module ‘community‘ has no attribute ‘best_partition‘ [已解决]

2022-08-09,,,,

问题描述:

python 执行graphs相关算法时,报错提示:

ModuleNotFoundError: No module named 'community

第一反应猜测是没安装community包,于是就熟悉的操作 pip install community安排上了

但是使用中,发现又会报错:

AttributeError: module ‘community’ has no attribute 'best_partition

解决办法:

起初以为是community 包的版本问题,后来发现是需要安装python-luovain (用于社区检测的louvain算法 )

解决步骤如下:
(安装前要先卸载community)

  1. pip uninstall community
  2. pip install python-louvain

之后community包就可以正常使用了:

本文地址:https://blog.csdn.net/HowieXue/article/details/105440114

《module ‘community‘ has no attribute ‘best_partition‘ [已解决].doc》

下载本文的Word格式文档,以方便收藏与打印。