There are all sorts of ways to determine whether the Python executable is a 32 or 64 Bit program. But is there a way to determine if the machine supports x64? All I found results in 32 Bit for a x86 Python distribution on a 64 Bit machine.
One way is to use sys.maxsize > (1 << 32)
, but it comes with the problem mentioned above.
Edit: Himal's first link already provides a somewhat-solution for Windows, checking the PROGRAMFILES
environment variable. I could then see if it contains the string (x86
)`.
A cross-platform solution would be nice, though. platform.platform()
is not a solution, I tried this before I asked the question already. It returns 32-Bit on 64-Bit Windows when using a 32-Bit Python executable.