【问题标题】:Use os.system to install a program on apt-get?使用 os.system 在 apt-get 上安装程序?
【发布时间】:2014-05-05 22:02:23
【问题描述】:

是否可以使用os.system 在 apt-get 上安装程序。到目前为止,这是我尝试过的:

if comm == "install":
  os.system("gnome-terminal -e sudo apt-get install"+args)

(args 是提供给命令的参数)

【问题讨论】:

  • 当然可以。但是你期待什么结果?你面临什么问题?

标签: python installation sudo apt-get


【解决方案1】:

这是可能的,但我个人会避免将 os.system()(或首选子进程模块调用)用于 python apt 接口:homepage

它比普通的 os.system() 提供了更多的灵活性(例如安装进度报告等)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多