matplotlib error - no module named tkinter
you can use
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
if you dont want to use tkinter
at all.
Also dont forget to use %matplotlib inline
at the top of your notebook if using one.
EDIT: agg
is a different backend like tkinter
for matplotlib.
For Windows users, there's no need to download the installer again. Just do the following:
- Go to start menu, type Apps & features,
- Search for "python" in the search box,
- Select the Python version (e.g. Python 3.8.3rc1(32-bit)) and click Modify,
- On the Modify Setup page click Modify,
- Tick td/tk and IDLE checkbox (which installs tkinter) and click next.
Wait for installation and you're done.
For Linux
Debian based distros:
sudo apt-get install python3-tk
RPM based distros:
sudo yum install python3-tkinter
For windows:
For Windows, I think the problem is you didn't install complete Python package. Since Tkinter should be shipped with Python out of box. See: http://www.tkdocs.com/tutorial/install.html . Good python distributions for Windows can be found by the companies Anaconda or ActiveState.
Test the python module
python -c "import tkinter"
p.s. I suggest installing ipython, which provides powerful shell and necessary packages as well.