Possible values from sys.platform?

dbr picture dbr · Jan 15, 2009 · Viewed 30.8k times · Source

What are the possible return values from the following command?

import sys
print sys.platform

I know there is a lot of possibilities, so I'm mainly interested in the "main" ones (Windows, Linux, Mac OS)

Answer

ICB picture ICB · Dec 14, 2012
┍━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━┑
│ System              │ Value               │
┝━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━┥
│ Linux               │ linux or linux2 (*) │
│ Windows             │ win32               │
│ Windows/Cygwin      │ cygwin              │
│ Windows/MSYS2       │ msys                │
│ Mac OS X            │ darwin              │
│ OS/2                │ os2                 │
│ OS/2 EMX            │ os2emx              │
│ RiscOS              │ riscos              │
│ AtheOS              │ atheos              │
│ FreeBSD 7           │ freebsd7            │
│ FreeBSD 8           │ freebsd8            │
│ FreeBSD N           │ freebsdN            │
│ OpenBSD 6           │ openbsd6            │
┕━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━┙

(*) Prior to Python 3.3, the value for any Linux version is always linux2; after, it is linux.