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

      <tfoot id='IgnUt'></tfoot>
    1. <small id='IgnUt'></small><noframes id='IgnUt'>

      <legend id='IgnUt'><style id='IgnUt'><dir id='IgnUt'><q id='IgnUt'></q></dir></style></legend>
        <bdo id='IgnUt'></bdo><ul id='IgnUt'></ul>
      1. 使 Python 脚本在 Windows 上运行而不指定“.py";延期

        时间:2023-07-23
        <tfoot id='8c2Nc'></tfoot>
          <legend id='8c2Nc'><style id='8c2Nc'><dir id='8c2Nc'><q id='8c2Nc'></q></dir></style></legend>
            <bdo id='8c2Nc'></bdo><ul id='8c2Nc'></ul>

            • <small id='8c2Nc'></small><noframes id='8c2Nc'>

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

                • 本文介绍了使 Python 脚本在 Windows 上运行而不指定“.py";延期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我希望能够在包含 python 脚本的文件夹中打开命令提示符,只需键入不带 .py 的脚本名称并观察它运行.

                  I want to able to open a command prompt at the folder which contains a python script and just type in the script name without the .py and watch it run.

                  按照谷歌上的各种提示来做这件事,我这样做了:

                  Following the various tips on google to do this, I do:

                  1. 将 python.exe 添加到我的路径
                  2. 将 .py 添加到 PATHEXT
                  3. 尝试在浏览的窗口中打开 .py 文件.当提示:你想打开什么程序?我导航到我的 python.exe

                  应该发生的情况是 python.exe 应该添加到打开方式"弹出窗口中,但不是吗?我重新尝试使用 python.exe 离开我的路径.同样的问题.

                  What should happen is the python.exe should be added to the 'Open With' pop up, but it is not? I re try with the python.exe off my path. Same problem.

                  请注意,每次我在控制面板中设置路径.python的版本是2.7.为了让事情变得更奇怪,我可以将 .py 程序与 pythonw 相关联——但这没有用,因为我想要控制台.

                  Note every time I set a path it is in the control panel. Version of python is 2.7. And to make things stranger, I can associate .py programs with pythonw - but this is no use, as I want the console.

                  任何帮助表示赞赏.

                  推荐答案

                  如前所述将 .PY 添加到 PATHEXT

                  Add .PY to PATHEXT as noted before

                  然后做:

                  assoc .py=Python.File
                  ftype Python.File=c:Python27python.exe "%1" %*
                  

                  在命令提示符下执行脚本或在资源管理器中双击不需要将 python 添加到路径中,仅当您想启动交互式 python 会话或使用 python yourscript.py 运行脚本时代码>

                  Adding python to the path isn't necessary to execute the script in a command prompt or double clicking in Explorer, only if you want to start an interactive python session or running the script with python yourscript.py

                  参见 http://docs.python.org/2/using/windows.html 了解更多详情.

                  See http://docs.python.org/2/using/windows.html for more details.

                  这篇关于使 Python 脚本在 Windows 上运行而不指定“.py";延期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

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

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