当前位置:   article > 正文

UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figur_backend tkagg is interactive backend. turning inte

backend tkagg is interactive backend. turning interactive mode on.

1、问题:Backend TkAgg is interactive backend. Turning interactive mode on.

matplotlib的默认backend是TkAgg,而FltkAgg, GTK, GTKAgg, GTKCairo, TkAgg , Wx or WxAgg这几个backend都要求有GUI图形界面的。

  1. import matplotlib.pyplot as plt
  2. Backend TkAgg is interactive backend. Turning interactive mode on.
  3. plt.get_backend()
  4. Out[3]: u'TkAgg'

解决方法:指定不需要GUI的backend(Agg, Cairo, PS, PDF or SVG

  1. import matplotlib.pyplot as plt
  2. 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

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/884270
推荐阅读
相关标签
  

闽ICP备14008679号