In python2.7 it's simple, just import the lib platform. But how can i see if my windows is 32 or 64 bits? I work with a system build in python2.2 and can't find a way of do that :(
Any sugestions?
In python2.7 it's simple, just import the lib platform. But how can i see if my windows is 32 or 64 bits? I work with a system build in python2.2 and can't find a way of do that :(
Any sugestions?
The platform
module source code is informative.
Backported from there to determine the machine architecture on a Windows platform, it would use:
import os
def machine():
try:
return os.uname()[-1]
except AttributeError:
if "PROCESSOR_ARCHITEW6432" in os.environ:
return os.environ.get("PROCESSOR_ARCHITEW6432", '')
else:
return os.environ.get('PROCESSOR_ARCHITECTURE', '')
In Python 2.x you can do this:
import sys
print sys.maxint
And detect if it's 32/64 bit by sys.maxint
.
Notice: this method may probably fail if you're running a 32 bit Python on a 64 bit machine.