admin管理员组

文章数量:1626244

最近在研究图模型,需要用到python中的库community,但是在安装过程后再弄个遇到了两个问题,在Q大神的帮助下已经解决,现在记录一下。

问题一: community的安装问题

(1)安装方法尝试:

直接采用pycharm中安装第三方库的方法,安装失败

直接在cmd命令行中执行pip install community,安装失败

(2)解决:

直接进入Python的安装目录下手动安装

本人由于电脑安装了anaconda,直接切换到conda下的Scripts目录下执行“pip install community”,路径为:D:\anaconda3\Scripts

安装完毕后会出现提示:“Successfully installed community-1.0.0b1”

 

问题二: community安装成功了,但是运行程序时,报错“AttributeError:module 'community' has no attribute 'modularity'”,即community中的函数没办法使用

(1)解决:直接在刚刚手动安装community的路径下,再安装一个库“python-louvain”。即切换至手动安装路径,执行“pip install python-louvain”

另附:

python-louvain官方文档链接:https://bitbucket/taynaud/python-louvain

community官方文档链接:https://perso.crans/aynaud/communities/api.html#community.best_partition

 

本文标签: Community