【发布时间】:2017-06-20 21:06:30
【问题描述】:
我想使用 subprocess 包从另一个 python 脚本 trigger.py 执行 python 脚本 executed.py。 executed.py 必须在与 trigger.py 不同的 conda 环境中运行(比如说 executed_env 和 trigger_env)。最好的方法是什么?我当前的trigger.py 代码是:
command = "python executed.py --option1 -dir /path/to/dir"
args = shlex.split(command)
my_subprocess = subprocess.Popen(args)
由于executed.py 在trigger_env 环境中运行,因此返回错误。
【问题讨论】:
标签: python subprocess environment conda