asdf-python
asdf-python copied to clipboard
ModuleNotFoundError: No module named '_tkinter'
Trying to use Tkinter and got this:
Traceback (most recent call last):
File "/home/kwilliams/Software/s1mple_img/s1mple.py", line 108, in <module>
from tkinter import Tk, Canvas, PhotoImage
File "/home/kwilliams/.asdf/installs/python/3.10.0/lib/python3.10/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'
How do I configure Tk?
Still having issues with this. Haven't been able to find good documentation surrounding compiling Python with Tkinter support. Help?
I'm also having the same problem with tkinter, I use asdf with Arch and WSL, I tried to find a solution but to no avail, so I ended up uninstalling asdf.
I just tried with 3.8.15 and it looks like it will compile with tk
support if the corresponding library is present on your system. For me, on fedora, that was tk-devel
.
So what worked for me was
$ asdf uninstall python 3.8.15
$ sudo dnf install tk-devel
$ asdf install python 3.8.15
Et voila, a python with tk (and thus tkinter) support.
Thanks!
After sudo dnf install tk-devel
and reinstalling, I got a new error: WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
Running sudo dnf install sqlite-devel
, uninstalling and reinstalling fixed this in Fedora 38. (leaving this here in case it helps someone)