有没有pythonic方法来检查操作系统是否是64位Ubuntu?
目前,我一直在这样做:
import os
def check_is_linux(distro, architecture, err_msg):
try:
this_os = os.popen('lsb_release -d').read()
this_arch = os.popen('uname -a').read()
assert distro in this_os and architecture in this_arch, err_msg
except:
print(err_msg)
def check_is_64bit_ubuntu(err_msg):
check_is_linux('Ubuntu', 'x86_64', err_msg)
答案 0 :(得分:3)
您可以使用the ACTION_IMAGE_CAPTURE
specification获取分发和处理器信息:
ACTION_IMAGE_CAPTURE
答案 1 :(得分:0)
使用platform
模块提供的功能,特别是platform.architecture和platform.uname。