pythonwindows-7x86x86-64windows-7-x64

Python incorrectly detects 32-bit system on Windows 8.1 64-bit


PS C:\Users\************> C:\Python27\python.exe
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')

Notice the "on win32" part (in "[MSC v.1500 64 bit (AMD64)] on win32").

"This PC" -> Properties also shows that windows is 64-bit. Same when I tried installing different Python3 versions.

Why does button detects OS 32-bit incorrectly? This prevents modules that only work on 64-bit from working.

Upd: reading https://groups.google.com/forum/#!topic/glazier-discuss/Gyrm2IsNhDA - Windows PE might cause problems.


Solution

  • win32 doesn't necessarily mean your windows is a 32bit system, It means you are on windows operating system, And it is just left there for historical reasons. And the properties on your This PC are enough to confirm it is 64bit windows. There is no win64 btw.

    The line you are looking for is this,
    [MSC v.1500 64 bit (AMD64)] - Meaning it was built with MSVC compiler for 64-bit

    and to more reliably check for if your interpreter is running as 32bit or 64bit try this,

    import sys
    print(sys.maxsize > 2**32) # must return TRUE for 64bit