python - 在命令行上一次性执行命令列表
问题描述
我正在设计从 Windows 命令行运行的破折号应用程序。我想在 go 中运行它,其中包含以下可能的指令:
- 创建 conda testenv
- pip install dash、plotly、pandas 和更多库
- 激活 conda 环境
- python dash_file.py
有没有更简单的方法来做到这一点?我是命令行执行的新手。我想为非技术人员运行它,他们可以一次安装和运行所有东西。
解决方案
使用函数
def execute_all(commands):
for command in commands:
os.system(command)
推荐阅读
- r - 使用 R 的季度雅虎财务数据
- python - python COVID-19 SIRD 模型 ODE symfit 不起作用
- javascript - 在 JavaScript 中,有没有办法制作一个按钮/文本字段组合,该组合将在文本字段的内容中附加一个空白段落
- reactjs - React Toastify - Not getting error notification
- app-store-connect - AppStore Connect - 无法为试飞构建提供信息
- mysql - SELECT中的Mysql SELECT
- lua - 使用 load() 将字符串用作函数时。它返回“尝试调用零值”
- python - 如何过滤数据框中的列表以仅包含唯一值?
- jspdf - 如何在 Tabulator 的 PDF 导出中设置列宽
- javascript - 如何使用 normalizr 解析 FractalTransformer