使用 os.system 安装 apt-get 上的程序?
可以用 os.system
来通过 apt-get 安装程序吗?我到目前为止尝试过这些:
if comm == "install":
os.system("gnome-terminal -e sudo apt-get install"+args)
(args 是传递给命令的参数)
1 个回答
1
这是可能的,但我个人建议不要使用 os.system()(或者更推荐使用 subprocess 模块)来操作 Python 的 apt 接口:主页
因为使用 subprocess 模块可以给你更多的灵活性,比如可以报告安装进度等等。