I have the issue with Python 3.9.1 on freshly installed Ubuntu (Ubuntu 20.04.1 LTS) - when running any tkinter-based application, I get import error (example from python console):
user@ubuntu:~$ python3
Python 3.9.1 (default, Dec 29 2020, 13:25:02)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/linuxbrew/.linuxbrew/Cellar/python@3.9/3.9.1_3/lib/python3.9/tkinter/__init__.py", line 37, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
I know this issue was discussed multiple times in SO and other internet resources, for several days I am trying all the options and solutions (like this, this, another one, brew forum neither of them solved the issue).
What works - only uninstalling homebrew does the trick. Still have hope to configure everything to work with homebrew.
What I have tried/performed:
- fixed all
brew doctor
reported issues:
Your system is ready to brew.
- tcl-tk is listed under
brew list
:
black hello libx11 libxdmcp openssl@1.1 pylint sqlite xorgproto
bzip2 libffi libxau libxext patchelf python@3.9 tcl-tk xz
gdbm libpthread-stubs libxcb ncurses pkg-config readline unzip zlib
performed
brew uninstall python
andbrew install python
Initial thought was poetry and/or pyenv broke the dependencies, currently using neither of them.
I am not hardcore ubuntu user, am I missing something? Any idea or help would be valuable.