ModuleNotFoundError: No module named 'Tkinter'
rehack opened this issue · 11 comments
Same problem LinuxMint
'3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]
Python 3.8.10
`Traceback (most recent call last):
File "./ProperTree/ProperTree.py", line 5, in
import Tkinter as tk
ModuleNotFoundError: No module named 'Tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./ProperTree/ProperTree.py", line 12, in
import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'
`
It's way to solve this https://stackoverflow.com/questions/34399387/linux-mint-17-tkinter-not-installed
pip3 install tkinter
should do the trick
you can use brew on macOS
just run brew install python-tk
I've solved this problem this way on macOS catalina 10.15.6.
I got "Tk older than 8.5.12 not supported." in the log, because the system provided Tcl/Tk libraries are too old.
refer to this:
Homebrew/homebrew-core#73987
The following is how I fixed it.
-
Install dependence
refer to this:
https://stackoverflow.com/questions/22550068/python-not-configured-for-tk/55441855#55441855 -
Let's say you're using pyenv.
pyenv version
pyenv global <version>
- Link to your python3 version
brew unlink python3 && sudo ln -snf ~/.pyenv/versions/3.11.2/bin/python3 /usr/bin/python3
finally I can run ProperTree.command
without errors.
pip install tkinter
for windows
brew install python-tk
for macOS
sudo apt install python-tk
for linux(ubuntu)
sudo apt install python-tk
for linux(ubuntu)
sudo apt install python3-tk
worked for me