I am trying to run python in 32 bit mode on Mac OS X Snow Leopard, and I have been having some success, but with the following weirdness.
If I run it with /usr/bin/python, it seems to not want to run in 32 bit mode, but if I run it using /usr/bin/python2.6, it runs in 32 bit mode fine. As far as I could tell before this point /usr/bin/python was the same as /usr/bin/python2.6. Does anyone know why they would behave differently here?
zrbecker:src$ /usr/bin/python --version
Python 2.6.1
zrbecker:src$ /usr/bin/python2.6 --version
Python 2.6.1
zrbecker:src$ arch -i386 /usr/bin/python2.6 -c 'import wx'
zrbecker:src$ arch -i386 /usr/bin/python -c 'import wx'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/__init__.py", line 45, in <module>
File "/var/tmp/wxWidgets/wxWidgets-13~231/2.6/DSTROOT/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py", line 4, in <module>
ImportError: /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/_core_.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)
In OS X 10.6, Apple provided a way to permanently select whether the Python 2.6 supplied in OS X runs in 64-bit mode or 32-bit mode (
VERSIONER_PYTHON_PREFER_32_BIT) and other options. Seeman 1 pythonfor details. The/usr/bin/pythonprogram is a front-end to that and examines the selected options, set either bydefaultplists or by environment variables, and spawn the desired interpreter version in the selected mode, regardless of the mode that the wrapper program is launched in (viaarchfor instance)./usr/bin/python2.6is a slightly modified version of the standard OS X pythonw program and it launches the interpreter in the mode it itself is launched in. The standard python.org distribution for 2.6 does not have similar code. In newer versions of Python, 2.7 and 3.2, the pythonw executable also honors the mode it is launched in, soarch -i386will work.By the way, Apple makes available here the source of various open source products, including Python, incorporated into OS X releases along with the customizations patches used to build it.