如何检测是否使用python3安装了Linux软件包

问题描述 投票:0回答:1

我想知道是否可以使用python3(实际上是3.8)知道是否在我的机器上安装了软件包(例如net-tools)。我尝试使用apt库(在PyCharm中),但下载时出现错误:

Collecting apt
  Could not find a version that satisfies the requirement apt (from versions: )
No matching distribution found for apt
python-3.x linux apt package-managers
1个回答
0
投票

为什么不简单使用:

import os
os.system('dpkg -l|grep net-tools')
© www.soinside.com 2019 - 2024. All rights reserved.