Matplotlib Crashing tkinter Application

情到浓时终转凉″ 提交于 2019-11-27 07:16:44

You need to set the TkAgg backend explicitly. I could reproduce your bug. With the following code, the problem is resolved.

import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt

Note that setting the TkAgg backend after importing pyplot does not work either; it crashes too. You need to set it before importing pyplot. (Tested with MPL 1.4.3, tkinter.TkVersion 8.6)

If you don't want to edit the code, you can use set the following environment variable that matplotlib is reading:

MPLBACKEND=TkAgg

This way, no matter when you import pyplot, it'll work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!