Pycharm does not show plot

后端 未结 25 1076
鱼传尺愫
鱼传尺愫 2020-12-04 09:13

Pycharm does not show plot from the following code:

import pandas as pd
import numpy as np
import matplotlib as plt

ts = pd.Series(np.random.randn(1000), in         


        
25条回答
  •  伪装坚强ぢ
    2020-12-04 09:39

    With me the problem was the fact that matplotlib was using the wrong backend. I am using Debian Jessie.

    In a console I did the following:

    import matplotlib
    matplotlib.get_backend()
    

    The result was: 'agg', while this should be 'TkAgg'.

    The solution was simple:

    1. Uninstall matplotlib via pip
    2. Install the appropriate libraries: sudo apt-get install tcl-dev tk-dev python-tk python3-tk
    3. Install matplotlib via pip again.

提交回复
热议问题