tags:

views:

50

answers:

4

I would like to install Python 2.5.5 to use with Google apps but have been having a very hard time tracking down instructions on how to do so. I am thinking the following might work but was wondering if anyone had successfully built it?

./configure --prefix=/usr/local/python2.5.5 MACOSX_DEPLOYMENT_TARGET=10.6 --enable-framework --with-universal-archs="64-bit" CFLAGS="-arch x86_64" LDFLAGS="-arch x86_64"

~: make -j6

~: sudo make install

Any help is appreciated!

+1  A: 

You should install it via MacPorts, which makes this a piece of cake. After you have it installed...

$ sudo port install python25
Dave Pirotte
Mac Ports make it very simple I was just curious if any one was successful compiling it themselves.
gsieranski
A: 

You should install it via Fink, which makes this a piece of cake. After you have it installed...

$ fink install python25

Fink has more packages than MacPorts.

EOL
A: 

Assuming that you are running OS 10.6, At the terminal if you type

% python<tab>

The terminal should show you all the python* items on your PATH. As suggested by @philipp, Python 2.5 and Python 2.6 are installed by default. You can see listed as:

python2.5
python2.6

You will also see an entry which is just python. This is the one that is going to used by default when you invoke the command python at the command line. To see the version of this default version either start it by typing python at the command line and note the text printed out at startup, or do a which python to see the absolute path for that executable.

The executables in the PATH on OS X are managed by links, so to see the actual location

ls -lha `which python`
ls -lha `which python2.5`
ls -lha `which python2.6`

Note the backtics will cause the which command to run and insert the result into the ls command.

Lastly, you can choose the version of Python which is the default by using the python_select command. I don't have a lot of experience with this, as I usually manage my access to Python via my own soft links or shell aliases.

That all being said, if you are going to be installing a lot of packages for development purposes give the advice of @Dave Pirotte a try. By using MacPorts, or fink, you will get a new installation of Python (and whatever further packages you need) outside of the system Python installation. This can be handy if you need to make a lot of modifications and if you're going to hard on the health of your Python installation it is easier to whipe the slate clean and start over if you don't mess with the default system Python.

dtlussier
A: 

Python 2.5 does not build correctly out of the box on Mac OS X 10.6. (It does build OK as is on 10.5 or 10.4, though.) There is at least one configure fix that needs to be backported from later Pythons. And you need to use gcc-4.0, not -4.2. Once you have extracted the source:

cd ./Python-2.5.5/
cat >patch-configure-for-10-6.patch <<EOF
--- configure.O 2008-12-13 06:13:52.000000000 -0800
+++ configure   2010-09-29 10:16:05.000000000 -0700
@@ -2039,7 +2039,11 @@
   # disables platform specific features beyond repair.
   # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
   # has no effect, don't bother defining them
-  FreeBSD/4.* | Darwin/[6789].*)
+  FreeBSD/4.*)
+    define_xopen_source=no;;
+  Darwin/[6789].*)
+    define_xopen_source=no;;
+  Darwin/1[0-9].*)
     define_xopen_source=no;;
   # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
   # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
EOF
patch < patch-configure-for-10-6.patch
export CC=/usr/bin/gcc-4.0
./configure --prefix=/usr/local --enable-framework MACOSX_DEPLOYMENT_TARGET=10.6
make
sudo make install

Then there are various less obvious build issues like third-party libraries that are needed for all of the standard library modules to build and work as expected - GNU readline and bsddb come to mind - so there is no guarantee that you won't run into other problems.

$ python2.5
Python 2.5.5 (r255:77872, Sep 29 2010, 10:23:54) 
[GCC 4.0.1 (Apple Inc. build 5494)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Module readline not available.
>>> 

You could try using the installer build script in the source tree (in Mac/BuildScript/) but it will likely need to be patched to work correctly on 10.6.

Even though there is no official python.org installer for 2.5.5 (which just has security fixes), there is an OS X installer for 2.5.4 which works fine on 10.6. Or use the Apple-supplied 2.5.4. Or try MacPorts. It will be nice when GAE is supported on current Python versions.

Ned Deily