欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-05-21 11:50:54
问题描述:python Network操作时,发现没有安装community包,提示:ModuleNotFoundError: No module named ‘community’于是就熟悉的操作 pip install community安装上了但是使用中,发现又会报错:AttributeError: module ‘community’ has no attribute ‘bes......

问题描述:

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

ModuleNotFoundError: No module named 'community’

第一反应猜测是没安装community包,于是就熟悉的操作 pip install community安排上了
module ‘community‘ has no attribute ‘best_partition‘ [已解决]
但是使用中,发现又会报错:

AttributeError: module ‘community’ has no attribute 'best_partition’
module ‘community‘ has no attribute ‘best_partition‘ [已解决]

解决办法:

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

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

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

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

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

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

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