[Pythonmac-SIG] Compiling Python 2.6.1 on Leopard

Reza Lotun reza at getpeer.com
Mon Dec 22 11:36:57 CET 2008


Hi Ned,

These instructions are what I put up on my company wiki, verbatim.
They describe a way to compile python2.6 as an "altinstall" so that it
doesn't interfere with the system python (a really good idea). To get
to the new python you simply invoke "python2.6" - that also means
you'll also have to reinstall each library you're interested by doing
something like "python2.6 setup.py install" for each library. These
instructions also makes it easy to use pyobjc, as needed by my
project, so you might not need all these options specified.

1. Download http://python.org/ftp/python/2.6.1/Python-2.6.1.tar.bz2

2. bzip2 -dc Python-2.6.tar.bz2 | tar -xvf -

3. Save these commands into a script called mybuild, do a chmod +x
mybuild and run it with ./mybuild:

export installprefix=/opt/python    # set this to wherever you want to put it
export DYLD_LIBRARY_PATH=$installprefix/lib:$DYLD_LIBRARY_PATH
export DYLD_FRAMEWORK_PATH=$installprefix/Library/Frameworks:$DYLD_LIBRARY_PATH:$DYLD_FRAMEWORK_PATH
export MACOSX_DEPLOYMENT_TARGET=10.5
export sdk=/Developer/SDKs/MacOSX10.5.sdk
export CPPFLAGS="-I$installprefix/include -L$installprefix/lib"
export CFLAGS="-O -g -isysroot $sdk -arch i386 -arch ppc
-mmacosx-version-min=10.5"
export LDFLAGS="-Wl,-syslibroot,$sdk -flat_namespace"

./configure \
   --enable-universalsdk=$sdk \
   --enable-framework=$installprefix/Library/Frameworks
make && make altinstall

Again, this will install Python 2.6 as an "alternative install" to not
interfere with the system Python. NOTE: you'll only be able to access
Python 2.6 by invoking python2.6 at the command line!

Hope this helps,
Reza


On Sun, Dec 21, 2008 at 2:11 AM, Ned Deily <nad at acm.org> wrote:
>
> In article
> <d52d80370812201733s46cdff8ewde7e9a813facca17 at mail.gmail.com>,
>  "R. Ellsworth Pollard" <rellsworthpollard at gmail.com> wrote:
> > Where might I find instructions for compiling Python on Leopard? I just
> > asked this on tutor and someone suggested that this list might be a better
> > place to ask. I'm specifically looking for how to compile Python to replace
> > the native installation of 2.5.1, what common libraries I should build it
> > with, and how to support readline. The default ./configure seems to compile
> > it to function as python2.6 instead of python, also.
>
> FYI, an "official" OSX installer disk image for 2.6.1 has just been
> added at python.org:
>
> <http://www.python.org/download/releases/2.6.1/>
>
> --
>  Ned Deily,
>  nad at acm.org
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



--
Reza Lotun
Senior Software Engineer
Peer Technologies Limited
reza at getpeer.com


More information about the Pythonmac-SIG mailing list