[Pythonmac-SIG] Installing unix Python on OS X...a few details wanted

Bob Ippolito bob@redivi.com
Wed, 9 Jan 2002 17:49:30 -0500


FYI, I was successful in building Tkinter for OS X without using X11 at 
all.  It seems to work pretty well, but only if you start python as an 
application bundle (i.e. by the finder or with "open").  The only caveat 
really is that you can only have one python interpreter running at a 
time..  Eventually I'm sure this problem will be solved, but would 
certainly require some clever hacking in macmain.c

I have a binary version of the package (python + tcl + tk + tkinter and 
some other goodies) at http://redivi.com/~bob/

If you want to do it yourself, build Tcl and Tk (get both from CVS, as 
they have aqua support) as frameworks and install to 
/Library/Frameworks/ (may need to sudo for this or edit a configure 
script).  ~/Library/Frameworks/ may work as well, but I didn't try any 
of that as there is more than one user of this computer.  Python should 
also be built as a framework and I very highly recommend getting 
libcompat from darwin CVS and hacking python's configure script to use 
libdl instead of dynload_next as dynload_next has serious issues and 
will get in your way at some point.

You should also mkdir /usr/local/include/X11 and copy the .h files that 
are included in Xlib/X11 in the Tk source tree, Tk's headers depend on 
X11 headers and the X11 headers don't get put into the Tk framework.

I didn't really have time to mess with Python's Modules/Setup file but 
here are some manual compile commands that should work for you as well, 
may have to change paths, and you'll probably have to sudo to do the 
last line if you haven't done any chmodding to the python framework as I 
did to make it easier on myself.  I'm not quite sure why Tcl and Tk use 
PrivateHeaders when applications depend on them to compile?

cc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -no-cpp-precomp -fno-common 
-dynamic -Ddarwin -DTK_FRAMEWORK -DTK_AQUA -DMAC_OSX_TK 
-F/Library/Frameworks/Python.framework 
-I/Library/Frameworks/Python.framework/Headers 
-F/Library/Frameworks/Tcl.framework 
-I/Library/Frameworks/Tcl.framework/Headers 
-F/Library/Frameworks/Tk.framework 
-I/Library/Frameworks/Tk.framework/Headers -I/usr/local/include 
-I/Library/Frameworks/Tk.framework/PrivateHeaders 
-I/Library/Frameworks/Tcl.framework/PrivateHeaders  -c _tkinter.c -o 
_tkinter.o

cc -Wl,-F. -Wl,-flat_namespace,-U,_environ -bundle -framework Python 
-framework Tk -framework Tcl _tkinter.o -o _tkinter.so -undefined 
suppress

cp _tkinter.so 
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.2/lib-tk/

-bob

On Wednesday, January 9, 2002, at 05:26 PM, Jack Jansen wrote:

> Educated guesses:
>
>> - Which python should I use? Fink offers one that explicitly excludes 
>> X, whic
>> h sounds suspicious. So I should use the standard unix distribution? 
>> Or perha
>> ps a command-line version of fink to get source?
>
> The X-based Tcl/Tk doesn't need X support in Python. So the version
> fink offers is probably fine.
>
>> - I already have tcl and tk on my Mac in System:Library:Tcl. So should 
>> I also
>>  install the fink version or should I skip that and hope Python can 
>> find it (
>> or configure it to do so)?
>
> I think the latter.
> --
> - Jack Jansen        <Jack.Jansen@oratrix.com>        
> http://www.cwi.nl/~jack -
> - If I can't dance I don't want to be part of your revolution -- Emma 
> Goldman -
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig