Python 属性错误:模块';matplotlib.cbook';没有属性';是核弹状的';在Networkx中

Python 属性错误:模块';matplotlib.cbook';没有属性';是核弹状的';在Networkx中,python,networkx,Python,Networkx,我已经阅读了许多关于如何修复此错误的问题及其答案,但不幸的是,我还没有修复此错误。错误是: AttributeError Traceback (most recent call last) <ipython-input-12-665806e1362f> in <module> 21 G.remove_nodes_from(list(nx.isolates(G))) 22 ---> 23 nx

我已经阅读了许多关于如何修复此错误的问题及其答案,但不幸的是,我还没有修复此错误。错误是:

AttributeError                            Traceback (most recent call last)
<ipython-input-12-665806e1362f> in <module>
     21 G.remove_nodes_from(list(nx.isolates(G)))
     22 
---> 23 nx.draw_networkx(G)

/anaconda3/lib/python3.7/site-packages/networkx/drawing/nx_pylab.py in draw_networkx(G, pos, arrows, with_labels, **kwds)
    276 
    277     node_collection = draw_networkx_nodes(G, pos, **kwds)
--> 278     edge_collection = draw_networkx_edges(G, pos, arrows=arrows, **kwds)
    279     if with_labels:
    280         draw_networkx_labels(G, pos, **kwds)

/anaconda3/lib/python3.7/site-packages/networkx/drawing/nx_pylab.py in draw_networkx_edges(G, pos, edgelist, width, edge_color, style, alpha, arrowstyle, arrowsize, edge_cmap, edge_vmin, edge_vmax, ax, arrows, label, node_size, nodelist, node_shape, **kwds)
    609         # value globally, since the user can instead provide per-edge alphas
    610         # now.  Only set it globally if provided as a scalar.
--> 611         if cb.is_numlike(alpha):
    612             edge_collection.set_alpha(alpha)
    613 

AttributeError: module 'matplotlib.cbook' has no attribute 'is_numlike'

我使用的是matplotlib和Jupyter笔记本(Python 3)的3.2.2版。

我和您有同样的问题

我一直在网上搜索,发现了这样的问题

尝试后发现问题来自pkg:networkx和pkg:matplotlib版本不匹配,因此可以通过卸载并重新安装软件包来解决上述问题

所以您可以升级或降级networkx/matplotlib来解决您的问题。

希望我能帮助你

matches = test[test['Text']>.08]['Name'].tolist()
edges = itertools.product(matches, matches)

G = nx.Graph()
G.add_nodes_from(test['Name'])
G.add_edges_from(edges)
G.remove_nodes_from(list(nx.isolates(G)))


plt.figure(figsize=(70,70))

nx.draw_networkx(G)