How to tell the difference between linux and mac

193 views Asked by At

I am creating a setup file for a tarball, and I need a way to determine the exact name of the system.

I tried os.name, but it returns 'posix' regardless of whether the system is mac or linux.

Is there a way to get a more specific OS name?

1

There are 1 answers

1
aE - Artai Esculta On BEST ANSWER

Simplest way:

>>> import sys
>>> sys.platform
'linux2'
>>>

On Mac it outputs something like 'darwin'