【发布时间】:2020-04-01 04:01:53
【问题描述】:
所以我之前运行代码并收到以下警告:
Warning (from warnings module):
File "<string>", line 558
RuntimeWarning: More than 20 figures have been opened. Figures created through
the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly
closed and may consume too much memory. (To control this warning, see the rcParam
`figure.max_open_warning`).
Warning (from warnings module):
File "<string>", line 665
RuntimeWarning: More than 20 figures have been opened. Figures created through
the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly
closed and may consume too much memory. (To control this warning, see the rcParam
`figure.max_open_warning`).
不会撒谎,我当时非常粗心,并且仍然在运行它,无视警告。 现在每当我尝试运行脚本时,我的 python shell 都不会运行脚本。
所以我试图从内存中删除图表以允许我再次运行脚本。
我已经尝试了以下方法,但它仍然不允许我运行代码:
-
plt.clf() plt.cla()-
f = plt.figure()f.clear()plt.close(f) plt.close('all')-
matplotlib.pyplot.figure().clear()matplotlib.pyplot.close()
我该如何解决这个问题?
【问题讨论】:
标签: python pandas matplotlib