在写论文时需要可视化网络结构,调用nx.draw()时出现如下报错:
AttributeError: module ‘matplotlib.pyplot’ has no attribute ‘ishold’
中文、英文网站上都无相应解决办法。
经过尝试,发现问题来源于pkg:networkx和pkg:matplotlib版本不匹配,因此可以通过卸载再重新安装包的方式解决上面的问题。
卸载
!pip uninstall networkx
!pip uninstall matplotlib
安装
!pip install matplotlib
!pip install networkx