目前我正在使用这个:
def _get_mac_ver():
import subprocess
p = subprocess.Popen(['sw_vers', '-productVersion'], stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
return stdout.strip()
是否有更好的版本(例如:使用内置的pythonapi)?在
^{pr2}$
注意:我尝试了在雪豹系统上打印10.3.0的os.uname()[2]
。在
Tags:
遵循python自带电池的理念,在标准库中有一个模块可以实现这一点:
platform
。在具体请参见`mac_ver()' function:
相关问题 更多 >
编程相关推荐