Install tkinter for Python

Karan picture Karan · Jan 24, 2011 · Viewed 696k times · Source

I am trying to import Tkinter. However, I get an error stating that Tkinter has not been installed:

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

I could probably install it using synaptic manager (can I?), however, I would have to install it on every machine I program on. Would it be possible to add the Tkinter library into my workspace and reference it from there?

Answer

9000 picture 9000 · Jan 24, 2011

It is not very easy to install Tkinter locally to use with system-provided Python. You may build it from sources, but this is usually not the best idea with a binary package-based distro you're apparently running.

It's safer to apt-get install python-tk on your machine(s). (Works on Debian-derived distributions like for Ubuntu; refer to your package manager and package list on other distributions.)