包引入报错 ImportError: cannot import name ‘best_partition‘ from ‘community‘

139 阅读1分钟

目录

一、问题描述

二、解决方法


一、问题描述

在 Python 代码中引入包:from community import best_partition 时报错:

ImportError: cannot import name 'best_partition' from 'community'

二、解决方法

虽然 best_partition 是在 community 中,但是装了 community 包仍然报错。

正确解法是删除 community 相关包,并下载安装 python-luovain (用于社区检测的louvain算法 )

 

以上,问题解决~