首页 > 解决方案 > 在命令行上一次性执行命令列表

问题描述

我正在设计从 Windows 命令行运行的破折号应用程序。我想在 go 中运行它,其中包含以下可能的指令:

  1. 创建 conda testenv
  2. pip install dash、plotly、pandas 和更多库
  3. 激活 conda 环境
  4. python dash_file.py

有没有更简单的方法来做到这一点?我是命令行执行的新手。我想为非技术人员运行它,他们可以一次安装和运行所有东西。

标签: pythoncommand-lineplotly-dash

解决方案


使用函数

def execute_all(commands):
    for command in commands:
        os.system(command)

推荐阅读