有没有一种 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)