python中plt.show()无法显示图片问题

问题描述:

出现以下情况

UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
  % get_backend())

解决办法,导入下边这个matplotlib.use('TkAgg')语句就可以了

import matplotlib; matplotlib.use('TkAgg')

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章