以下命令可能返回值是什么?
import sys
print sys.platform
我知道有很多可能性,所以我主要对“主要”的(Windows、Linux、Mac )感兴趣。
发布于 2009-01-15 10:03:17
Mac OS X (10.4、10.5、10.7、10.8):
darwin
Linux (2.6内核):
linux2
Windows XP 32位:
win32
括号中的版本已检查-其他/较新版本可能是相同的。
发布于 2012-12-14 15:49:06
┍━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━┑
│ 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 │
┕━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━┙
(*)在Python3.3之前,任何Linux版本的值都是linux2
;在之后,它是linux
。
发布于 2009-01-15 10:06:02
FreeBSD 7.0:freebsd7
。FreeBSD8,但构建是在以前的版本上执行的,答案相同。
因此,请注意,您获得的是用于构建的平台,而不一定是您正在运行的平台。
https://stackoverflow.com/questions/446209
复制相似问题