Python 2.4 and Tkinter

Jeffrey Barish jeffbarish at starband.net
Fri Dec 3 00:00:59 CET 2004


Jean Brouwers wrote:

> 
> Here is how we understand this (which may be incomplete and/or
> incorrect).
> 
> The _tkinter module is a shared library _tkinter.o and that is built
> from C source file _tkinter.c.  That C file and a few other tk related
> C files are included in the Python distribution.
> 
> But the Tcl/Tk libraries to build the _tkinter module are coming from
> /usr/local/lib in our case.  And those happens to be tcl83 and tk83 in
> our case.
> 
> If the Tcl/Tk libraries (and include files) are missing, you will have
> to get and install those.  But they are not part of the Python
> distribution, as far as we know.
> 
> /Jean Brouwers
> 
> 
> 
> In article <mailman.6999.1101954197.5135.python-list at python.org>,
> Jeffrey Barish <jeffbarish at starband.net> wrote:
> 
>> Jean Brouwers wrote:
>> 
>> > 
>> > FWIW, we just installed Python 2.4 (on RH Linx 8), rebuilt it from
>> > scratch and everything is fine.  Tkinter is there, _tkinter as well
>> > and idle comes up as expected.
>> > 
>> > /Jean Brouwers
>> > 
>> > 
>> > 
>> > In article <mailman.6996.1101939598.5135.python-list at python.org>,
>> > Jeffrey Barish <jeffbarish at starband.net> wrote:
>> > 
>> >> http://www.python.org/moin/TkInter
>> 
>> 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?

OK, I downloaded tcl8.4.8 and tk8.4.8.  They are now installed.  Back to
python2.4 make.  It now bombs at:

gcc -pthread -shared build/temp.linux-i686-2.4/_tkinter.o
build/temp.linux-i686-2.4/tkappinit.o -L/usr/X11R6/lib64
-L/usr/X11R6/lib -L/usr/local/lib -ltk8.4 -ltcl8.4 -lX11 -o
build/lib.linux-i686-2.4/_tkinter.so
*** WARNING: renaming "_tkinter" since importing it failed: libtk8.4.so:
cannot open shared object file: No such file or directory
running build_scripts

Here's what I don't get:

root at duo:/tmp/Python-2.4# ls -l /usr/local/lib/libtk8.4.so
-rwxr-xr-x    1 root     staff      893866 2004-12-02
15:28 /usr/local/lib/libtk8.4.so

The library is there but gcc claims that it isn't.  Any suggestions?
-- 
Jeffrey Barish




More information about the Python-list mailing list