In a fit of masochism I installed the i386/x86_64 binary of Python 2.7 for Mac, which is available from:
http://www.python.org/ftp/python/2.7.1/python-2.7.1-macosx10.6.dmg
on my laptop.
Note that
$ file $(which python)
reports Mach-O executable i386 and Mach-O 64-bit executable x86_64 for this installation of python.
I wanted to use scipy and matplotlib, which is where the trouble began because there are not binaries of those for python 2.7 for this architecture. Here is what I had to do:
$ wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
$ sh setuptools-0.6c11-py2.7.egg
$ wget http://pypi.python.org/packages/source/p/pip/pip-0.8.2.tar.gz#md5=df1eca0abe7643d92b5222240bed15f6
$ tar xfvz pip-0.8.2.tar.gz
$ cd pip-0.8.2
$ python setup.py install
$ git clone git://github.com/numpy/numpy.git numpy
$ cd numpy/
$ python setup.py install
Note that you have to have gnu fortran (gfortran) installed to build scipy
$ svn co http://svn.scipy.org/svn/scipy/trunk scipy
$ cd scipy
$ python setup.py build --fcompiler=gnu95
$ python setup.py install
$ wget http://cdnetworks-us-1.dl.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz
$ tar xfvz matplotlib-1.0.1.tar.gz
$ cd matplotlib-1.0.1
In make.osx, I made the following changes:
-
from:
PYVERSION=2.6
to:
PYVERSION=2.7
-
from:
ARCH_FLAGS=-arch i386-arch x86_64
to:
ARCH_FLAGS=-arch i386 -arch x86_64
-
replaced
-arch i386 -arch x86_64
with "
$(ARCH_FLAGS)
in the other FLAGS variables
-
commented out the fetching of
libpng
from the
fetch
target.
-
removed the line continuation characters and newlines (I don't think this was necessary, but it helped me debug the problems I was having).
-
from:
cp .libs/libpng.a .
to:
cp .libs/libpng14.a ..
in the png target.
In Makefile I made the changed "
ppc
" to "
x86_64
"
Then I could:
$ git clone git://libpng.git.sourceforge.net/gitroot/libpng/libpng
$ export PREFIX=/full/path/to/my/prefix/dir
$ make -f make.osx fetch deps mpl_build mpl_install
$ cd ..
Add $PREFIX to my PYTHONPATH variable (in my bash_profile and source it).