问题描述:
python 执行graphs相关算法时,报错提示:
ModuleNotFoundError: No module named 'community’
第一反应猜测是没安装community包,于是就熟悉的操作 pip install community安排上了
但是使用中,发现又会报错:
AttributeError: module ‘community’ has no attribute 'best_partition’
解决办法:
起初以为是community 包的版本问题,后来发现是需要安装python-luovain (用于社区检测的louvain算法 )
解决步骤如下:
(安装前要先卸载community)
- pip uninstall community
- pip install python-louvain
之后community包就可以正常使用了: