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

        <tfoot id='dVf0r'></tfoot>

      1. <small id='dVf0r'></small><noframes id='dVf0r'>

        Popen 错误:[Errno 2] 没有这样的文件或目录

        时间:2023-07-22

            <tbody id='GrnN9'></tbody>

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

                <bdo id='GrnN9'></bdo><ul id='GrnN9'></ul>

                • <small id='GrnN9'></small><noframes id='GrnN9'>

                • <tfoot id='GrnN9'></tfoot>
                • 本文介绍了Popen 错误:[Errno 2] 没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一些自定义命令.

                  # works 
                  subprocess.Popen(['python'], stdout=subprocess.PIPE)
                  

                  但如果我有自己的系统命令,例如 deactivate,我会收到该错误

                  But if I have my own system commands like deactivate, I get that error

                  Traceback (most recent call last):
                    File "runner2.py", line 21, in <module>
                      main() 
                    File "runner2.py", line 18, in main
                      subprocess.Popen(['deactivate',], stdout=subprocess.PIPE)
                    File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
                      errread, errwrite)
                    File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
                      raise child_exception
                  OSError: [Errno 2] No such file or directory
                  

                  更不用说我需要在我的沙盒 virtualenv 下执行这个了.

                  Let alone I need to execute this under my sandbox virtualenv.

                  推荐答案

                  尝试在 Popen 调用中添加一个额外的参数 shell=True.

                  Try add an extra parameter shell=True to the Popen call.

                  这篇关于Popen 错误:[Errno 2] 没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何避免【Errno 12】使用子进程模块导致的Cannot allocate memory错误 下一篇:如何读取子进程标准输出的第一个字节,然后在 Python 中丢弃其余字节?

                  相关文章

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

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

                  1. <tfoot id='VNTlH'></tfoot><legend id='VNTlH'><style id='VNTlH'><dir id='VNTlH'><q id='VNTlH'></q></dir></style></legend>