Changed in version 2.7.3: Since lots of code check for sys.platform == 'linux2', and there is no essential change between Linux 2.x and 3.x, sys.platform is always set to 'linux2', even on Linux 3.x.
sys.platform is always set to 'linux2', even on Linux 3.x. In Python
3.3 and later, the value will always be set to 'linux', so it is recommended to always use the startswith idiom presented above.
因为
sys.platform
不是内核版本。它是编译时添加到python二进制文件或库中的字符串。在linux上它总是linux2,除了python3.3之后,它变成了linux
。在Possible values from sys.platform?
来自the docs:
根据documentation:
相关问题 更多 >
编程相关推荐