modulenotfounderror no module named 'tkinter' windows code example
Example 1: ModuleNotFoundError: No module named 'tkinter'
sudo apt-get install python3-tk
Example 2: ImportError: No module named _tkinter, please install the python-tk package
sudo apt-get install python-tk
Example 3: ModuleNotFoundError: No module named 'Tkinter'
try:
# for Python2
# sudo apt-get install python-tk
from Tkinter import * ## notice capitalized T in Tkinter
except ImportError:
# for Python3
# sudo apt-get install python3-tk
from tkinter import * ## notice lowercase 't' in tkinter here