1
有没有python的方法来检查操作系统是否是64位的Ubuntu?有没有python的方法来检查操作系统是否是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)
谢谢! '平台'很棒!但小错误,它应该是''is_linux('ubuntu','x86_64')''因为'platform.linux_distribution()[0] .lower()' – alvas
@alvas:啊,是的,是我的错。很高兴我有帮助! –