複雜網路中louvain演算法實現時報錯AttributeError: module ‘community‘ has no attribute ‘best_partition‘
匯入包的方式有點奇怪,用的不是包名“python-louvain”而是“community”,
import community as community_louvain
在jupyter中執行“partition = community_louvain.best_partition(G) #進行圖劃分”的時候出現以下錯誤:
AttributeError: module ‘community’ has no attribute 'best_partition' 。
第一反應猜測是沒安裝community包,於是就熟悉的操作 pip install community安排上了。
但是使用中,發現又會報錯:
AttributeError: module ‘community’ has no attribute 'best_partition’。
解決辦法:
起初以為是community 包的版本問題,後來發現是需要安裝python-luovain (用於社群檢測的louvain演算法 )
解決步驟如下:
(安裝python-louvain前要先解除安裝community)
- pip uninstall community
- pip install python-louvain
或者直接將GitHub中的包檔案下載到python庫(C:\Anaconda3\Lib\site-packages)中,下載路徑為:https://github.com/taynaud/python-louvain/archive/master.zip(或者https://github.com/JavyWang/python-louvain)
然後解壓後在python-louvain-master目錄開啟cmd,用下面的命令安裝:
python setup.py install
安裝完畢後發現,site-packages中多了一個community包。
當然,還有:
相關文章
- AttributeError: 'module' object has no attribute 'lock'ErrorObject
- AttributeError: module ‘requests‘ has no attribute ‘_version_‘Error
- [轉]成功解決AttributeError: module ‘enum‘ has no attribute ‘IntFlag‘?Error
- AttributeError: 'dict' object has no attribute 'has_key'ErrorObject
- AttributeError: module...ops‘ has no attribute ‘_TensorLike‘, ValueError: `updates` argument..eagerError
- AttributeError: 'Settings' object has no attribute 'HBase'ErrorObject
- AttributeError: module ‘tensorflow._api.v1.nn.rnn_cell‘ has no attribute ‘InputProjectionWrapper‘ErrorAPIRNNProjectAPP
- 【Error】AttributeError: module ‘scipy.misc‘ has no attribute ‘logsumexp‘ 的解決辦法Error
- AttributeError: module‘ tensorflow_core._api.v2. train‘ has no attribute‘ AdamOptimizer‘ErrorAPIAI
- Rasa init報錯:AttributeError: type object 'Callable' has no attribute '_abc_registry'ErrorObject
- module ‘h5py‘ has no attribute ‘File‘H5
- module ‘tensorflow‘ has no attribute ‘get_default_graph‘
- 問題解決:AttributeError: ‘NoneType‘ object has no attribute ‘append‘ErrorNoneObjectAPP
- 解決pycharm問題:module 'pip' has no attribute 'main'PyCharmAI
- Traceback (most recent call last): File "AttributeError: 'NoneType' object has no attribute 'group'ASTErrorNoneObject
- python 3呼叫paramiko模組報錯AttributeError: modulePythonError
- 1_使用face_recognition模組:錯誤AttributeError:'PngStream' object has no attribute 'chunk fcWp'(20190223)ErrorObject
- 【佈局進階】巧用 :has & drop-shadow 實現複雜佈局效果
- Process object has no attribute '_popen'Object
- ‘dict‘ object has no attribute ‘iteritems‘Object
- 網路流複雜度證明複雜度
- multiprocessing pool AttributeError: Can't get attribute 'func'Error
- 網路模型複雜度計算方法模型複雜度
- 現代化配置管理以解決網路複雜性
- Java實現:排序演算法--時間複雜度為O(n² )Java排序演算法時間複雜度
- 各種排序演算法思想複雜度及其java程式實現排序演算法複雜度Java
- GridLayoutManager 實現 複雜列布局
- SVG 實現複雜線條動畫SVG動畫
- ‘FirewallD‘ object has no attribute ‘path‘ 、‘fw‘、is not registeredObject
- 演算法--複雜度演算法複雜度
- 演算法複雜度演算法複雜度
- 演算法:複雜度演算法複雜度
- 排序演算法:堆排序的實現和時間複雜度分析排序演算法時間複雜度
- 並行Louvain社群檢測演算法並行AI演算法
- 【坑】Tkinter ‘NoneType‘ object has no attribute ‘destroy‘NoneObject
- python去掉excel空格和換行,報錯'int' object has no attribute 'strip'PythonExcelObject
- 演算法複雜度分析演算法複雜度
- 演算法複雜性分析演算法