[Pythonmac-SIG] machine architecture 32/64 with Python 2.6 on Snow Leopard?
emoy at apple.com
emoy at apple.com
Sat Sep 19 02:15:22 CEST 2009
On Sep 18, 2009, at 5:05 PM, Bill Janssen wrote:
> William Kyngesburye <woklist at kyngchaos.com> wrote:
>
>> If you run the CLI 'uname -m' on any Intel Mac, it always has
>> returned
>> i386. So all it really means is 'Intel'.
>>
>> On Sep 18, 2009, at 5:53 PM, Bill Janssen wrote:
>>
>>> I'm running /usr/bin/python on SL, and
>>>
>>> import platform; print platform.machine()
>>>
>>> give me
>>>
>>> i386
>>>
>>> But Activity Monitor shows Python as "Intel (64-bit)".
>>>
>>> Is this a bug in platform.machine(), or am I misunderstanding what
>>> i386
>>> means? "platform.architecture()" returns ('64bit', '').
>
> Hmmm. So what's the pythonic way of getting i386 vs. x86_64?
>
> {'32bit': 'i386', '64bit': 'x86_64'}[platform.architecture()[0]]
>
> seems so complicated that there should be a routine for it in sys or
> platform.
I don't know the "official" way, but what I do is:
% python -c 'import sys;print sys.maxint'
9223372036854775807
% env VERSIONER_PYTHON_PREFER_32_BIT=1 python -c 'import sys;print
sys.maxint'
2147483647
So I would look at sys.maxint to determine if python is running 32 or
64-bit.
Ed
More information about the Pythonmac-SIG
mailing list