Python 2.4 and Tkinter

Eric Brunel eric_brunel at despammed.com
Thu Dec 2 03:47:18 EST 2004


Jeffrey Barish wrote:
[snip]
> Here's what I get when I import Tkinter at a python prompt:
> 
> jeffbarish at duo:~$ python
> Python 2.4 (#1, Nov 30 2004, 08:58:13)
> [GCC 3.2.3 20030316 (Debian prerelease)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>>import Tkinter
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 38, in ?
>     import _tkinter # If this fails your Python may not be configured
> for Tk
> ImportError: No module named _tkinter
> 
> I tried make clean and make.  Same result.  Ah, now I see that the
> output from make includes:
> 
> INFO: Can't locate Tcl/Tk libs and/or headers
> 
> Aren't the libs and headers included in Python-2.4.tgz?

On Windows, the Python distribution does include Tkinter and tcl/tk. It's 
different on Unices (including Linux): since tcl/tk is very often installed by 
default, it is not included in the Python distribution.

Have you looked for libraries / header files in /usr/lib and /usr/include? This 
is usually where they go when you install them with Linux. Since you mentionned 
you upgraded to Python 2.4, I assume you had a working installation of a 
previous Python version. So the tcl/tk libraries and header files must be there 
somewhere. Did you look at your Modules/Setup for the older Python? If Tkinter 
was working with this version, the setup for the _tkinter module should use the 
correct paths.

HTH
-- 
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com



More information about the Python-list mailing list