[英]UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure
[英]Why am I getting UserWarning: Matplotlib is currently using ps, which is a non-GUI backend, so cannot show the figure
这不在jupyter
笔记本中,因此这不是此问题的重复项 ,但是我的代码是:
from gluoncv import model_zoo, data, utils
from matplotlib import pyplot as plt
...
plt.show()
我得到的错误是:
/figure.py:445: UserWarning: Matplotlib is currently using ps, which is a non-GUI backend, so cannot show the figure.
% get_backend())
我在https://repl.it/@shamoons/WelloffHarmfulMineral创建了一个repl
如果有问题,我正在使用OSX。我需要做些什么才能显示图像?
matplotlib.use('PS')
和plt.show()
是互斥的。 您需要决定:
matplotlib.use('PS')
。 PS
后端吗? 这似乎不太可能,因为除非在服务器上工作,否则几乎没有理由将后端设置为非交互式。 无论如何,解决方案:将plt.show()
替换为plt.savefig("filname.ps")
。 您可以使用
matplotlib.use("TkAgg")
代替
matplotlib.use("PS")
在MacOS上进行开发时。
请注意,导入应在导入plt
之前进行,如下所示:
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.