[python-win32] How do I detect a 64 bit version of Windows?

Brian Curtin brian at python.org
Sat Feb 18 21:07:00 CET 2012


On Sat, Feb 18, 2012 at 13:22, Gremlin <gremlin at armarize.com> wrote:
> This may help:
>
> WIN64 = 'PROGRAMFILES(X86)' in os.environ
>
> Best regards
> ________________________________
>
> Von: python-win32-bounces+gremlin=armarize.com at python.org
> [mailto:python-win32-bounces+gremlin=armarize.com at python.org] Im Auftrag von
> Vernon Cole
> Gesendet: Samstag, 18. Februar 2012 17:53
> An: python-win32 at python.org
> Betreff: [python-win32] How do I detect a 64 bit version of Windows?
>
>So, how can I tell which "width" of Windows I am running, so I know which
> connection string to use?

import platform
platform.machine()

That will return "AMD64" on 64 bit. I don't have a 32-bit machine
available but I believe it returns "x86".


ps, I can't find your thread on the IronPython list right now, but
platform.architecture() will help you find the architecture Python is
compiled for.


More information about the python-win32 mailing list