if [DISTRO,VERS,ARCH] = platform.linux_distribution()
我只需要知道不同发行版的 DISTRO 是什么。我正在运行 arch,所以我当然有。我也有openuse。我需要 ubuntu/debian、fedora、RHEL、sorcerer linux、slackware、gentoo 和您能想到的任何其他软件的输出。
如果不删除我的 arch 安装(在 32GB 闪存驱动器上运行),我无法安装其他发行版来测试它。
最佳答案
查看platform.py
源代码:
_supported_dists = (
'SuSE', 'debian', 'fedora', 'redhat', 'centos',
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
'UnitedLinux', 'turbolinux', 'arch', 'mageia')
请注意,您几乎总是最好检查您需要的功能/程序/库,而不是检查平台。
也许 Python 维护者也这么想,因为 linux_distribution()
是 deprecated从 Python 3.5 开始,将在 Python 3.7 中删除。
关于linux - 所有主要发行版的 platform.linux_distribution() 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44499081/