<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 环境变量

      subprocess.call env var(subprocess.call 环境变量)
      <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 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                env: python: No such file or directory(env: python: 没有这样的文件或目录)
                How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                    <tbody id='sODmr'></tbody>

                    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>