Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

is64bit.py 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. """is64bit.Python() --> boolean value of detected Python word size. is64bit.os() --> os build version"""
  2. import sys
  3. def Python():
  4. if sys.platform == "cli": # IronPython
  5. import System
  6. return System.IntPtr.Size == 8
  7. else:
  8. try:
  9. return sys.maxsize > 2147483647
  10. except AttributeError:
  11. return sys.maxint > 2147483647
  12. def os():
  13. import platform
  14. pm = platform.machine()
  15. if pm != ".." and pm.endswith("64"): # recent Python (not Iron)
  16. return True
  17. else:
  18. import os
  19. if "PROCESSOR_ARCHITEW6432" in os.environ:
  20. return True # 32 bit program running on 64 bit Windows
  21. try:
  22. return os.environ["PROCESSOR_ARCHITECTURE"].endswith(
  23. "64"
  24. ) # 64 bit Windows 64 bit program
  25. except (IndexError, KeyError):
  26. pass # not Windows
  27. try:
  28. return "64" in platform.architecture()[0] # this often works in Linux
  29. except:
  30. return False # is an older version of Python, assume also an older os (best we can guess)
  31. if __name__ == "__main__":
  32. print("is64bit.Python() =", Python(), "is64bit.os() =", os())