I am having some trouble triggering the 32-bit python for my macports python2.7
calvins-MacBook ttys003 Tue Nov 01 01:04:23 |~|
calvin$ arch -arch x86_64 python
Python 2.7.2 (default, Oct 31 2011, 20:10:35)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.10.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; platform.architecture()
('64bit', '')
>>> exit()
calvins-MacBook ttys003 Tue Nov 01 01:04:49 |~|
calvin$ arch -arch i386 python
Python 2.7.2 (default, Oct 31 2011, 20:10:35)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.10.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; platform.architecture()
('64bit', '')
>>>
How should I go about triggering the use of 32-bit python?
Will run the binary in 32-bit mode (which is what you did).
If you installed Python via MacPorts, check that it was actually built with 32-bit and 64-bit (universal binary).
This is output on mine:
If you don’t see the
i386, then you your version doesn’t have a 32-bit build.Though if you can run
arch -i386 pythonyou should be fine, since you will get an error if your binary can’t run 32-bit mode.Also, do not rely on
platform.architecture()to tell you if it’s 32-bit, because universal binaries will report 64-bit mode even if you’re in 32-bit. It’s better to rely onsys.maxsize, which changes depending on if you’re in 32-bit or 64-bit mode.Python in 32-bit mode, notice
sys.maxsize > 2**32:Python in 64-bit mode: