Install Tkinter On Amazon Linux
You don't want (and probably you can't) install tkinter in that server. Configure matplotlib to use a non-interactive backend instead.
Put this in your matplotlibrc
file:
backend : agg
UPDATE This should not be necessary for matplotlib >= 3.0.0, according to the documentation "[h]eadless linux servers (identified by the DISPLAY env not being defined) will not select a GUI backend".
to add to @Goyo. you can switch the mode to agg in code as well.
import matplotlibmatplotlib.use('agg',warn=False, force=True)from matplotlib import pyplot as pltprint "Switched to:",matplotlib.get_backend()
Could you give python version information?
1- Try to install this:
yum install python-tools
This package uses tkinder so can help.
2- If you use python3:
sudo yum install python3-tkinter
3- Download and install the package:http://rpm.pbone.net/index.php3?stat=3&search=python27-tkinter&srodzaj=3&dist[]=79