0

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.

Niklas R
  • 16,299
  • 28
  • 108
  • 203
  • Take a look at [this](http://stackoverflow.com/a/2208869/1189040) and [this](http://stackoverflow.com/a/1842575/1189040) – Himal Sep 17 '14 at 04:23
  • possible duplicate of [Detect 64bit OS (windows) in Python](http://stackoverflow.com/questions/2208828/detect-64bit-os-windows-in-python) – RobertoAllende Sep 17 '14 at 04:43
  • @Himal Your first link provides a solution for my problem on Windows, but I need something more cross-platform, and should work for at least Linux and Darwin as well. – Niklas R Sep 17 '14 at 11:06
  • @RobertoAllende Same link as the Himal's second, and no, this is not a solution to the problem. As I pointed out specifically in the question, I want to detect a 64-Bit OS even if a 32-Bit Python executable is running. `platform.platform()` does this **not**. – Niklas R Sep 17 '14 at 11:07

0 Answers0