Search code examples
pythontkinter

Tkinter throws ImportError


I was trying to make my first Tkinter project in Python but it just shows me this:

>>> from tkinter import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/tkinter/__init__.py", line 38, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
    ^^^^^^^^^^^^^^^
ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

I am using Arch.

I have tried pip install tkinter but it didn't help.

Pls help


Solution

  • Try # pacman -S tk I had the same problem and that fixed it.