赞
踩
1、问题:Backend TkAgg is interactive backend. Turning interactive mode on.
matplotlib的默认backend是TkAgg,而FltkAgg, GTK, GTKAgg, GTKCairo, TkAgg , Wx or WxAgg这几个backend都要求有GUI图形界面的。
- import matplotlib.pyplot as plt
- Backend TkAgg is interactive backend. Turning interactive mode on.
-
- plt.get_backend()
- Out[3]: u'TkAgg'
解决方法:指定不需要GUI的backend(Agg, Cairo, PS, PDF or SVG)
- import matplotlib.pyplot as plt
- plt.switch_backend('agg')
2、问题:UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure
解决方案:
import matplotlib
matplotlib.use('TkAgg')
参考:
https://www.icode9.com/content-4-32530.html
https://blog.csdn.net/neninee/article/details/87972040#commentsedit
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。