-1

When I run import tkinter I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/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'

Ruuning apt-get install python3-tk doesn't sove this issue.

Running Python 3.9 on Debian Experimental

Aurora Lanes
  • 45
  • 1
  • 7
  • Pick one from: [`"No module named '_tkinter'"`](https://stackoverflow.com/search?q=isanswered%3Ayes+is%3Aquestion+%5Bpython%5D%5Btkinter%5D+%22No+module+named+%27_tkinter%27%22) – stovfl Jan 13 '20 at 18:18
  • Maybe this one: https://stackoverflow.com/questions/5459444/tkinter-python-may-not-be-configured-for-tk – Wouterr Jan 13 '20 at 18:24
  • "Ruuning apt-get install python3-tk doesn't sove this issue. " That is because this can **only** add Tkinter support for the **system** Python, but the path `/usr/local/lib/python3.9` tells us that this is a separately installed Python. It must instead be recompiled with Tkinter support. Please see the linked duplicate for details. – Karl Knechtel Apr 30 '23 at 00:19

1 Answers1

-2

Maybe you can try import tkinter instead of import _tkinter

F.M
  • 1,369
  • 1
  • 16
  • 31
  • @Bryan Oakley that's why, so `import tkinter` instead of `import _tkinter` – F.M Jan 13 '20 at 19:44
  • 2
    They are importing tkinter; tkinter imports _tkinter. The very first line of the question says they are importing tkinter. – Bryan Oakley Jan 13 '20 at 19:57