networkx显示random_state_index不正确
我正在尝试用 networkx 和 Python 绘制简单的图形。
这是我的代码:
import networkx as nx
import matplotlib.pyplot as plt
G = nx.complete_graph(5)
nx.draw(G, with_labels=True, font_weight='bold')
plt.show()
但我收到错误
Message=random_state_index is incorrect
Source=***PythonTest.py
StackTrace:
File "***PythonTest.py", line 15, in <module>
nx.draw(G, with_labels=True)
Python 3.7 64bit
OS Windows
networkx 2.2 ,2.3 或 2.5 也有同样的问题。
回答
看起来这个问题可能是由于decorator模块的新版本。见这里:https : //github.com/networkx/networkx/issues/4718
你能降级你的版本decorator吗?
- Thanks, Downgrade matplotlib version to 2.2.3 and decorator to 4 solve problem
- As also discussed in the other related question and answer (https://stackoverflow.com/a/66922837/11339311), decorator 5.0.5 has fixed the error.