matplotlib crashing Python

后端 未结 5 1447
不思量自难忘°
不思量自难忘° 2021-01-13 16:21

I\'m new to Python and matplotlib. A simple script I wrote is crashing and I was able to reproduce the crash with the following code:

import matplotlib.pyplo         


        
5条回答
  •  深忆病人
    2021-01-13 16:58

    You need to set the TkAgg backend explicitly. 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.

提交回复
热议问题