williamtroup williamtroup - 10 months ago 75
Python Question

Detect 64bit OS (windows) in Python

Does anyone know how I would go about detected what bit version Windows is under Python. I need to know this as a way of using the right folder for Program Files.

Many thanks


platform module -- Access to underlying platform’s identifying data

>>> import platform
>>> platform.architecture()
('32bit', 'WindowsPE')

On 64-bit Windows, 32-bit Python returns:

('32bit', 'WindowsPE')

And that means that this answer, even though it has been accepted, is incorrect. Please see some of the answers below for options that may work for different situations.