Question

This question already has an answer here:

This is essentially the same as asking how to detect that I am running under a 64-bit version of Windows.

os.name gives 'nt' under both win7 64 and winXP 32 (my two available test computers). sys.platform gives 'win32' in both of those cases.

It looks like the only thing I've found so far that works is to check the registry key HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier and if 'x86' doesn't appear in it, assume that means 64-bit windows. Is that reliable?

(the python process needs to run under python 2.7 32-bit)

Was it helpful?

Solution

Consider checking the PROCESSOR_ARCHITECTURE key in os.environ, and seeing if it's set to x86 or not.

Alternatively, you can use the platorm.architecture() call, but point it at a different executable from the Python one (since you're required to run under 32bit Python).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top