How to figure out if the platform is 32bit or 64bit?
p at ulmcnett.com
Sat Aug 2 07:44:18 CEST 2008
Gary Josack wrote:
> Trent Mick wrote:
>> Manuel Vazquez Acosta wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>> Just test for maxint value:
>>> from sys import maxint
>>> if maxint >> 33:
>>> print "more than 32 bits" # probably 64
>>> print "32 bits"
>> I believe that was already suggested in this thread. That test will
>> just tell you if the Python *build* is 32-bit or 64-bit. If the answer
>> is 32-bit, then that doesn't tell you if this is a 32-bit Python
>> running on a 64-bit OS.
> have you tried platform.architecture()?
I just tried it:
WindowsXP in Parallels Desktop:
Ubuntu 7.10 in Parallels Desktop:
Ubuntu 8.04 on a AMD64 Machine:
Mac 10.4 on a Intel64 Machine:
All look correct except for Mac.
More information about the Python-list