I am trying to plot a simple graph using pyplot, e.g.:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[5,7,4])
plt.show()
but the figure
Just in case if this helps anybody.
Python version: 3.7.7 platform: Ubuntu 18.04.4 LTS
This came with default python version 3.6.9, however I had installed my own 3.7.7 version python on it (installed building it from source)
tkinter was not working even when the help('module')
shows tkinter in the list.
The following steps worked for me:
sudo apt-get install tk-dev.
rebuild the python: 1. Navigate to your python folder and run the checks:
cd Python-3.7.7
sudo ./configure --enable-optimizations
sudo make -j 8
--- here 8 are the number of processors, check yours using nproc
command.Installing using:
sudo make altinstall
Don't use sudo make install, it will overwrite default 3.6.9 version, which might be messy later.
python3.7 -m tkinter
A windows box will pop up, your tkinter is ready now.