Matplotlib错误 currently using agg, cannot show the figure

Environment

Ubuntu 16.04
Python 3.6.1 (there are both py2 and py3 in my system)
(Note: run for python2, no error)

Error

Matplotlib can’t plot the image

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

Solution

python3.6:

pip3 uninstall matplotlib
pip3 install matplotlib

sudo apt-get install python3.6-tk

Note:
run python3-tk, doesn’t work
I don’t need matplotlib.use("TkAgg")

The references do not so support me

https://www.pyimagesearch.com/2015/08/24/resolved-matplotlib-figures-not-showing-up-or-displaying/

你可能感兴趣的:(Python)