因此,我在前面运行代码时收到了以下警告:
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()
{plt.close('all')
matplotlib.pyplot.figure().clear()
matplotlib.pyplot.close()
如何解决此问题
尽管这可以满足您的需要,但这不是一个受支持的接口,可能会过时。我不知道还有其他方法可以做到这一点,这是我推荐它的唯一原因
相关问题 更多 >
编程相关推荐