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

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

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

      1. 打开命令行时Windows环境变量发生变化?

        时间:2023-07-04
        <tfoot id='QOoOB'></tfoot><legend id='QOoOB'><style id='QOoOB'><dir id='QOoOB'><q id='QOoOB'></q></dir></style></legend>

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

                • 本文介绍了打开命令行时Windows环境变量发生变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有时当我在 Windows 中更改我的环境变量,然后使用依赖于这些变量的软件时,它们没有正确更新.

                  Sometimes when I change my environment variables in Windows, and then use software the depends on those variables, they are not properly updated.

                  一个很好的例子是更改一个变量,然后打开 Windows 命令行并回显该变量并查看它没有被更改,即使您在环境变量"窗口中正确更改了它.

                  And good example is to change a variable, then open up Windows Command Line and echo the variable and see that it hasn't been changed, even though you properly changed it in the Environment Variables window.

                  我现在正在处理的另一个例子:

                  Another example I'm dealing with right now:

                  我在一个项目中使用 Python 2.4.x 已经有一段时间了,它使用了 env var PYTHONPATH 的值是:

                  I've been using Python 2.4.x for a while for a project, which uses the env var PYTHONPATH who's value has been:

                  C:Python24;C:Python24lib
                  

                  今天我为该项目安装了 Python 2.5.x.我将 PYTHONPATH 更改为:

                  Today I installed Python 2.5.x for the project. I changed my PYTHONPATH to be:

                  C:Python25;C:Python25lib
                  

                  当我使用 Python 2.5 运行脚本并执行此操作时:

                  When I use Python 2.5 to run a script and do this:

                  import sys
                  print sys.path
                  

                  打印出来:

                  'C:\PYTHON24', 'C:\PYTHON24\lib' (and some other Python 2.5 related default installation paths)
                  

                  很明显,旧的 PYTHONPATH 环境变量更改并没有真正坚持......

                  So clearly, the old PYTHONPATH environment variable changes aren't really sticking....

                  有谁知道为什么会发生这种情况以及如何解决它?

                  Does anyone know why this happens and how to fix it?

                  推荐答案

                  当您在系统属性"选项卡中更改环境变量时,新值将传播到 Windows 资源管理器,并打开任何应用程序(如 cmd.exe)从 Windows 资源管理器(或运行框、开始菜单等)应该会看到新值.

                  When you change an environment variable in the System Properties tab, the new value will propagate to the Windows Explorer, and any apps (such as cmd.exe) opened from the Windows Explorer (or the Run box, Start Menu, etc.) should see the new value.

                  但是,如果您正在运行诸如编辑器或 python 或某些非 Microsoft 程序启动器之类的程序,则更改环境变量,然后从该程序(而不是 Windows 资源管理器)启动 cmd.exe,您很可能查看环境变量的旧值.原因是正在运行的程序忽略了来自Windows的通知,说环境发生了变化(一点也不异常),并且由于启动的进程继承了环境变量,所以子进程不会看到变化.

                  However, if you're running a program such as an editor or python or some non-Microsoft program launcher, then change an environment variable, and then launch cmd.exe from that program (instead of Windows Explorer) you are likely to see the old value of the environment variable. The reason is that the running program ignored the notification from Windows saying that the environment has changed (not at all unusual), and since the launched process inherits the environment variables, the child process won't see the changes.

                  解决方法是确保从 Windows 资源管理器或运行"框启动应用.重新启动您的机器也可以工作(如果重新启动不能解决问题,那么还有其他问题).

                  The workaround is to make sure you start your app from Windows Explorer or the Run box. Rebooting your machine will work also (if rebooting doesn't solve the problem, then something else is going on).

                  这篇关于打开命令行时Windows环境变量发生变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Windows 中将 DJANGO_SETTINGS_MODULE 永久设置为环境变量 下一篇:解析配置文件、环境和命令行参数,以获取单个选项集合

                  相关文章

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