Archive

Archive for April, 2016

“import tkinter” fails

April 27, 2016 Leave a comment

Problem
Under Manjaro I wanted to use the turtle module but I got this error:

File "square.py", line 1, in <module>
    import turtle
  File "/usr/lib/python2.7/lib-tk/turtle.py", line 107, in <module>
    import Tkinter as TK
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 39, 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

Solution

sudo pacman -S tk

Ubuntu 14.04
I had the same problem under Ubuntu when I tried to use matplotlib on a remote server.

sudo apt install python3-tk
Categories: python, ubuntu Tags: , , ,