Detecting 64bit vs. 32bit Linux

dwelch91 donald.welch at hp.com
Fri Jul 7 14:03:24 EDT 2006


I need to detect whether the operating system I am running on (not the 
Python version) is 64bit or 32bit. One requirement is that I need to 
include support for non-Intel/AMD architectures.

The 2 ways I have thought detecting 64bit are:

1. struct.calcsize("P") == 8
2. '64' in os.uname()[4]

I'm not convinced that either one of these is really adequate. Does 
anybody have any other ideas on how to do this?

Thanks,

Don





More information about the Python-list mailing list