<tfoot id='UQxVB'></tfoot>

    1. <legend id='UQxVB'><style id='UQxVB'><dir id='UQxVB'><q id='UQxVB'></q></dir></style></legend>
      • <bdo id='UQxVB'></bdo><ul id='UQxVB'></ul>

      <i id='UQxVB'><tr id='UQxVB'><dt id='UQxVB'><q id='UQxVB'><span id='UQxVB'><b id='UQxVB'><form id='UQxVB'><ins id='UQxVB'></ins><ul id='UQxVB'></ul><sub id='UQxVB'></sub></form><legend id='UQxVB'></legend><bdo id='UQxVB'><pre id='UQxVB'><center id='UQxVB'></center></pre></bdo></b><th id='UQxVB'></th></span></q></dt></tr></i><div id='UQxVB'><tfoot id='UQxVB'></tfoot><dl id='UQxVB'><fieldset id='UQxVB'></fieldset></dl></div>

      <small id='UQxVB'></small><noframes id='UQxVB'>

    2. subprocess.call 环境变量

      时间:2023-07-04
      <tfoot id='hXaGZ'></tfoot>
        <tbody id='hXaGZ'></tbody>
    3. <i id='hXaGZ'><tr id='hXaGZ'><dt id='hXaGZ'><q id='hXaGZ'><span id='hXaGZ'><b id='hXaGZ'><form id='hXaGZ'><ins id='hXaGZ'></ins><ul id='hXaGZ'></ul><sub id='hXaGZ'></sub></form><legend id='hXaGZ'></legend><bdo id='hXaGZ'><pre id='hXaGZ'><center id='hXaGZ'></center></pre></bdo></b><th id='hXaGZ'></th></span></q></dt></tr></i><div id='hXaGZ'><tfoot id='hXaGZ'></tfoot><dl id='hXaGZ'><fieldset id='hXaGZ'></fieldset></dl></div>
      • <bdo id='hXaGZ'></bdo><ul id='hXaGZ'></ul>

          <legend id='hXaGZ'><style id='hXaGZ'><dir id='hXaGZ'><q id='hXaGZ'></q></dir></style></legend>

            <small id='hXaGZ'></small><noframes id='hXaGZ'>

                本文介绍了subprocess.call 环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我使用 Popen 是因为我需要 env,如下所示:

                I'm using Popen because I need the env, like this:

                Popen(
                    ["boto-rsync", "..."],
                    env={"PATH":"/Library/Frameworks/Python.framework/Versions/2.7/bin/"},
                    )
                

                问题是 Popen 将命令作为新线程运行.有什么方法可以将 env 传递给 subprocess.call 或阻止 Popen 创建新线程?谢谢

                The problem is Popen runs the command as a new thread. Is there any way that I could pass the env to subprocess.call or prevent Popen from creating a new thread? Thanx

                推荐答案

                您可以使用 env 与 call 的方式与 popen 完全相同:

                You can use env with call in the exact same way as with popen:

                subprocess.call(
                    ["boto-rsync", "..."],
                    env={"PATH":"/Library/Frameworks/Python.framework/Versions/2.7/bin/"},
                    )
                

                这篇关于subprocess.call 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:子进程完成运行后如何获取其环境变量? 下一篇:python - os.getenv 和 os.environ 看不到我的 bash shell 的环境变量

                相关文章

                  1. <i id='sODmr'><tr id='sODmr'><dt id='sODmr'><q id='sODmr'><span id='sODmr'><b id='sODmr'><form id='sODmr'><ins id='sODmr'></ins><ul id='sODmr'></ul><sub id='sODmr'></sub></form><legend id='sODmr'></legend><bdo id='sODmr'><pre id='sODmr'><center id='sODmr'></center></pre></bdo></b><th id='sODmr'></th></span></q></dt></tr></i><div id='sODmr'><tfoot id='sODmr'></tfoot><dl id='sODmr'><fieldset id='sODmr'></fieldset></dl></div>
                  2. <small id='sODmr'></small><noframes id='sODmr'>

                    <legend id='sODmr'><style id='sODmr'><dir id='sODmr'><q id='sODmr'></q></dir></style></legend>
                    <tfoot id='sODmr'></tfoot>
                    • <bdo id='sODmr'></bdo><ul id='sODmr'></ul>