本文最后更新于:2025年4月14日 晚上
Python使用matplotlib时有时会报出和 agg相关的错误,本文记录两种常见错误的解决方案。
问题1
UserWarning: Matplotlib is currently using agg, which is a non-GUI backend
- agg是一个没有图形显示界面的终端,常用的有图形界面显示的终端有TkAgg等,将终端更换一下就好了。
1 |
|
问题2
TclError: no display name and no $DISPLAY environment variable Backend TkAgg is interactive backend. Turning interactive mode on.
- 这是由于在没有图形终端的场景下使用了TkAgg,换成没有图形的就好了。
1 |
|
文章链接:
https://www.zywvvd.com/notes/coding/python/matplotlib-agg/matplotlib-agg/
“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信支付

支付宝支付
Python - Matplotlib 关于 agg 相关错误的解决方法
https://www.zywvvd.com/notes/coding/python/matplotlib-agg/matplotlib-agg/