Python Matplotlib:无法在spyder中关闭交互模式

Python Matplotlib:无法在spyder中关闭交互模式,python,matplotlib,spyder,Python,Matplotlib,Spyder,从 使用此代码: import matplotlib.pyplot as plt plt.ioff() plt.plot([1.6, 2.7]) plt.show() show()。但它不会,show()不会阻止执行。我可以添加一些代码到IPython外壳,而我的图形仍然显示 Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] Type "copyright", "credits" or "lice

使用此代码:

import matplotlib.pyplot as plt
plt.ioff()
plt.plot([1.6, 2.7])
plt.show()
show()。但它不会,
show()
不会阻止执行。我可以添加一些代码到IPython外壳,而我的图形仍然显示

Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 6.5.0 -- An enhanced Interactive Python.
我的后端是'Qt5Agg'


我在另一个python环境(来自Cygwin)上测试了这段代码:它工作完美。

您可以通过

Tools/Preferences/IPython Console/Graphics/Support for graphics(Matplotlib)/Activate support 工具/首选项/IPython控制台/图形/图形支持(Matplotlib)/激活支持

停用matplotlib支持并不能解决此问题,它对我来说很好。更改该选项后是否重新启动spyder?另外,也许你可以花更多的话在如何运行代码上?(我在这里假设您显示的代码是spyder编辑器中的一个文件,并通过F5或run/run运行)我仔细检查了一下,它并不能解决我的问题。无论是从文件还是从ipython运行代码,show都不会使用给定代码阻塞。奇怪的问题。你在“启动”项下填了什么吗?您的spyder版本也可能会引起兴趣。