2

I'm wondering how to find the architecture of the machine python is running on and save it to a string. The only other example I've been able to find works only on Windows, and doesn't even detect the proper architecture if it's Windows on Arm. Any solutions would be greatly appreciated.

Thanks,
NullUsxr

7

1 Answer 1

0
import platform
print(platform.system())

According to https://docs.python.org/3/library/platform.html#platform.system it says the function would "Returns the system/OS name, such as 'Linux', 'Darwin', 'Java', 'Windows'. An empty string is returned if the value cannot be determined."

Sign up to request clarification or add additional context in comments.

1 Comment

Good idea, though it doesn't tell me if 'Darwin' or 'Windows', etc. is 32-bit, 64-bit, aarch64 and so on. Using platform.architecture(executable=sys.executable, bits='', linkage='') from the same source as yours, also returns an invalid value if on the aarch64 architecture.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.