• Fully functioning Python with MySQL, Ldap, P4Python, installed
• Use pip
Limitations:
• None so far — P4Python was not x86_64/i386 compatible but that now is fixed..
Notes:
• Stock python on Snow Leopard ships as a 32-bit only application (file /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5)
Building readline-6.0
Normally you won’t have to set these variables up but since we want a 32 bit with a 64 bit readline we need to ensure these are set up..
export MACOSX_DEPLOYMENT_TARGET=10.6
export CFLAGS=“-arch i386 -arch x86_64”
export LDFLAGS=“-Wall -arch i386 -arch x86_64”
./configure
make
sudo make install
Building Python 2.6.4
If you use a custom ~/.pydistuti“s move it out of the way! This will build an intel only version of Python.
./configure --enable-framework MACOSX_DEPLOYMENT_TARGET=10.6 --with-universal-archs=intel --enable-universalsdk=/
make
sudo make install
After the make you should see errors like this..
Failed to find the necessary bits to build these modules:
_bsddb dl gdbm
imageop linuxaudiodev ossaudiodev
spwd sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module’s name.
MySQL (Not Python)
Get the latest MySQL 64-bit (of course). Pull the file from MySQL.com
Get the Snow Leopard Preference Panel for 64-bit from here
Getting rolling with pip.
If y’u use a custom ~/.pydistutils put it back..
Get setuptools (0.6c11) from pypi.
python2.6 setup.py build
python2.6 setup.py test
python2.6 setup.py install
Get pip from pypi
python2.6 setup.py build
python2.6 setup.py install
Start getting your apps..
pip install --install-option=“--prefix=/Users/sklass/perforce/dev/tools/python/Mac” nose
Now build up MySQLdb
python2.6 setup.py build
python2.6 setup.py test
python2.6 setup.py install
5 comments:
Snow Leopard comes with 32-bit Python 2.5.4 and 64-bit Python 2.6.1.
Also, if you really want to custom compile stuff, I can't recommend homebrew http://github.com/mxcl/homebrew enough. Generally though, i've stuck with the 64 bit version of 2.6 it ships.
I'd recommend using MacPorts for updated Python binaries. Through it, I installed Python 2.6.4, 2.5.4 & 2.4.6.
I have just installed python-2.6.3 with Macport, since I couldn't find 2.6.4 package there. Where did you find the package?
Thanks for the native readline fix.
The dl module actually compiles fine, hack setup.py:
# Dynamic loading module
#print sys.maxint, 0x7fffffff
if sys.maxint == 0x7fffffff:
# This requires sizeof(int) == sizeof(long) == sizeof(char*)
dl_inc = find_file('dlfcn.h', [], inc_dirs)
if (dl_inc is not None) and (platform not in ['atheos']):
exts.append( Extension('dl', ['dlmodule.c']) )
else:
missing.append('dl')
else:
#missing.append('dl')
exts.append( Extension('dl', ['dlmodule.c']) )
Post a Comment