ImportError: libtk8.6.so: cannot open shared object file: No such file or directory

KnownAsDon picture KnownAsDon · Jan 29, 2018 · Viewed 25k times · Source

While being new to python and not having a lot of knowldege on it I got stuck in a problem. I am trying to add a GUI input box and I found out that the way you do that is by using a module called tkiner. While I was trying to install it on my arch linux machine through the ActivePython package I got the following error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/tkinter/__init__.py", line 36, 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

shell returned 1\

This might be a common problem but because of my lack of knowldege I bare you to be as simple as possible with me...thank you!

Answer

KnownAsDon picture KnownAsDon · Jan 29, 2018

All you need to do is to install the tkinter package. Now universal precompiled packages such as ActivePython will not work, well at least it didn't work for me. I don't know if this problem occurs in other OSes but I know the solution for Linux: Install the Tk package from the terminal.

In Arch, Tk is available in the Arch repository. You don't need aur for this, just type on the terminal:

sudo pacman -S tk

If you are on another Linux distro such as Debian or a Debian based distro you will probably have to find a PPA repository online and in Debian based distros just type on the terminal:

sudo apt-get install tk

Which applies to all distros.