【问题标题】:Find all installed softwares in the centos linux using python script使用python脚本查找centos linux中所有已安装的软件
【发布时间】:2017-11-02 09:43:16
【问题描述】:

如何使用 Python 脚本在 centos linux 中查找已安装软件包的列表?

【问题讨论】:

  • 你为什么需要python呢?你可以使用rpm -qayum list installed

标签: python centos7


【解决方案1】:

您可以使用 rpm 命令查询 centos 软件包:

rpm -qa

python 程序可能如下所示:

import subprocess
output = subprocess.check_output(['rpm', '-qa'])
for package in output.split('\n'):
  print(package)

【讨论】:

    猜你喜欢
    • 2017-05-26
    • 2011-09-29
    • 2022-01-16
    • 1970-01-01
    • 2017-10-18
    • 2020-07-19
    • 1970-01-01
    • 2018-01-27
    相关资源
    最近更新 更多