Python Matplotlib savefig在笔记本后端工作时崩溃

Python Matplotlib savefig在笔记本后端工作时崩溃,python,matplotlib,jupyter-notebook,Python,Matplotlib,Jupyter Notebook,在Jupyter笔记本中,matplolib无法保存figure。MVE: from matplotlib import pyplot as plt %matplotlib notebook fig, ax = plt.subplots() fig.savefig("1.png") 产生: AttributeError Traceback (most recent call last) /usr/lib/python3.8/site-pac

在Jupyter笔记本中,matplolib无法保存figure。MVE:

from matplotlib import pyplot as plt
%matplotlib notebook
fig, ax = plt.subplots()
fig.savefig("1.png")
产生:

AttributeError                            Traceback (most recent call last)
/usr/lib/python3.8/site-packages/matplotlib/backend_bases.py in _wait_cursor_for_draw_cm(self)
   2772             try:
-> 2773                 self.set_cursor(cursors.WAIT)
   2774                 yield

/usr/lib/python3.8/site-packages/matplotlib/backends/backend_webagg_core.py in set_cursor(self, cursor)
    380         if cursor != self.cursor:
--> 381             self.canvas.send_event("cursor", cursor=cursor)
    382         self.cursor = cursor

/usr/lib/python3.8/site-packages/matplotlib/backends/backend_webagg_core.py in send_event(self, event_type, **kwargs)
    345     def send_event(self, event_type, **kwargs):
--> 346         self.manager._send_event(event_type, **kwargs)
    347 

AttributeError: 'NoneType' object has no attribute '_send_event'
而在非交互式
%matplotlib inline
中,一切都可以正常工作。 Matplotlib:3.2.0,ipython:7.13.0。有没有办法解决这个问题


谢谢

这似乎是一个悬而未决的问题,根据