I recently installed Python and IDLE from synaptic. However, when I test Tkinter I get the following error:

import Tkinter


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3790, in _test
    root = Tk()
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable tk.tcl in the following directories: 
    /usr/local/src/tcl8.6.1/library/tk8.6 /usr/local/src/tcl8.6.1/tk8.6 /usr/lib/tk8.6 /usr/local/lib/tk8.6 /lib/tk8.6 /usr/library

This probably means that tk wasn't installed properly.

However, I have installed tk using the following command:

sudo apt-get install tk8.6 tk-dev

I have no idea what is going on. In order to install the module environment I have compiled tcl8.6.1 from source in /usr/local/src/tcl8.6.1. Could that be the problem?

Thank you



  • Yes based on the /usr/local/src/... path mentioned in the error it is likely that your locally-compiled tcl is the issue. There may be some tcl-specific environment variables (TCL_LIBRARY or TCLLIBPATH perhaps?) that you can set as a workaround. May 27 '14 at 12:39
  • Yes I used the TCL_LIBRARY environmental variable to set the path to /usr/local/src/... The problem is that I do not know where tk.tcl is located upon a fresh IDLE install.
    – user285733
    May 27 '14 at 12:57
  • It's probably somewhere like /usr/share/tcltk/tcl8.6 but you should be able to check by invoking the system version of tclsh (e.g. /usr/bin/tclsh) and typing info library. May 27 '14 at 13:02
  • Thanks, I copied the tk8.6 directory in /usr/share/tcltk/tcl8.6 to usr/local/lib and it works find now!
    – user285733
    May 27 '14 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.