【发布时间】:2017-11-02 09:43:16
【问题描述】:
如何使用 Python 脚本在 centos linux 中查找已安装软件包的列表?
【问题讨论】:
-
你为什么需要python呢?你可以使用
rpm -qa或yum list installed
如何使用 Python 脚本在 centos linux 中查找已安装软件包的列表?
【问题讨论】:
rpm -qa 或yum list installed
您可以使用 rpm 命令查询 centos 软件包:
rpm -qa
python 程序可能如下所示:
import subprocess
output = subprocess.check_output(['rpm', '-qa'])
for package in output.split('\n'):
print(package)
【讨论】: