Building Python with non-standard tcl/tk support

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Mar 4 01:50:53 CET 2012


On Sat, 03 Mar 2012 10:17:40 -0800, Westley Martínez wrote:

> On Sat, Mar 03, 2012 at 05:36:52PM +0000, Steven D'Aprano wrote:
>> I'm trying to re-build Python 3.2 with support for TCL/TK 8.5, but when
>> I run "make" I get this message:
>> 
>> Failed to build these modules:
>> _tkinter
>> 
>> and after installing 3.2 I still have this:
>> 
>> >>> import _tkinter
>> >>> _tkinter.TK_VERSION
>> '8.4'
>> 
>> 
>> What do I need to do to have Python 3.2 use tcl/tk 8.5?
>> 
>> 
>> I have installed tcl/tk 8.5.11 from source, and the binaries are here:
>> 
>> /usr/local/lib/libtcl8.5.so
>> /usr/local/lib/libtk8.5.so
>> 
>> 
>> In the Python 3.2 source, I do the usual:
>> 
>> ./configure
>> make
>> sudo make altinstall
>> 
>> 
>> (altinstall to avoid nuking the system Python)
> 
> That's all you should have to do, but on my system the Tk libraries are
> in /usr/lib not /usr/local/lib.  So try doing ./configure
> --prefix=/usr/local or try setting LDFLAGS to "-L/usr/local/lib".

Thanks, but that doesn't work. "make" still says it failed to build 
_tkinter, and after "make altinstall" it still picks up tck/tkl 8.4.


Okay, now I'm making progress... if I remove the previously existing 
_tkinter in lib-dynload, and re-run "make", I get something new:

building '_tkinter' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -DWITH_APPINIT=1 -I/usr/X11/include -IInclude -I. -I./
Include -I/usr/local/include -I/tmp/Python-3.2.2 -c /tmp/Python-3.2.2/
Modules/_tkinter.c -o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
_tkinter.o
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -DWITH_APPINIT=1 -I/usr/X11/include -IInclude -I. -I./
Include -I/usr/local/include -I/tmp/Python-3.2.2 -c /tmp/Python-3.2.2/
Modules/tkappinit.c -o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
tkappinit.o
gcc -pthread -shared build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
_tkinter.o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/tkappinit.o 
-L/usr/X11/lib -L/usr/local/lib -ltk8.5 -ltcl8.5 -lX11 -o build/lib.linux-
i686-3.2/_tkinter.cpython-32m.so
*** WARNING: renaming "_tkinter" since importing it failed: libtk8.5.so: 
cannot open shared object file: No such file or directory

Failed to build these modules:
_tkinter




-- 
Steven



More information about the Python-list mailing list