出现该问题,由于Matplotlib版本不兼容或代码中使用了过时、或者过新导致的的方法而导致的。
解决方案(亲测有效):
1.在https://www.lfd.uci.edu/~gohlke/pythonlibs/查找存在的对应版本
2.升级或降级Matplotlib版本到对应版本。例如:我是3.8.2(也太高了),我降级成3.5.2
注:可以在cmd中改,也可以这样改更快,这篇博文Python报错:AttributeError: ‘AxesSubplot‘ object has no attribute ‘bar_label‘_axessubplot' object has no attribute 'set_extent-CSDN博客