Building Python on Mac

How To Build Python 2.5 on Mac OS X 10.6

  • This will detail the steps necessary to build Python 2.5 on Mac OS X 10.6.
  • This could be useful should we need a debug version of Python to help diagnose errors from libraries we call externally from Python (e.g., SuperLU)
    1. Download and extract the Python source code from: http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz

    2. Make sure you use the gcc compiler 4.0: export CC=/usr/bin/gcc-4.0

    3. We need to specify 32 bit compilation: export EXTRA_CFLAGS=-m32

    4. This is the configure setup I used: ./configure –enable-framework MACOSX_DEPLOYMENT_TARGET=10.6 –with-universal-archs=64-bit –enable-universalsdk=/Developer/SDKs/MacOSX10.6.sdk –prefix=<specify where you want it to be installed>

    5. If desired, build with debugging on: make OPT=-g, otherwise just build it: make

    6. Then install it: make install

Notes on building NumPy (1.5.1)

  • You need to make sure that you use the older version of gcc, so you need to do: export CC=/usr/bin/gcc-4.0

  • Make sure that numpy/f2py/crackfortran.py has been updated to allow for more than 72 characters in a line

Notes on building SciPy (0.11.0)

  • It did not find my umfpack header files, so I had to manually add their location to distutils: numpy/distutils/system_info.py
  • I also had to use version 4.4 of gfortran, as with 4.2.1 it was getting errors unable to find f591