Fix “ImportError: No module named _tkinter” In Debian/Ubuntu and Derivatives

Hey Guys,

As a Python beginner, I always like to share problems I encounter as I move along to day I got an import error on my Cruchbang box and want share with you. I guess you might also have had the same issue hence coming across this.

In this tutorial, we fix a simple import error below after running >>> import turtle

ImportError: No module named _tkinter, please install the python-tk package

Here is the full view of how this error was caught.


 Python 3.4.1 (default, May 19 2014, 17:23:49)
 [GCC 4.9.0 20140507 (prerelease)] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import turtle
 Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/lib/python3.4/", line 107, in <module>
 import tkinter as TK
 File "/usr/lib/python3.4/tkinter/", line 38, in <module>
 import _tkinter # If this fails your Python may not be configured for Tk
 ImportError: cannot open shared object file: No such file or directory

The error message is very clear and all that needs to be installed is Tkinter

sudo apt-get install python-tk

Next time your import turtle from python shell it should pass.

 >>> import turtle


Hope this helps!