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

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

    2. <legend id='X72rH'><style id='X72rH'><dir id='X72rH'><q id='X72rH'></q></dir></style></legend>

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

        何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了

        When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
        <tfoot id='oEo6l'></tfoot>

                <tbody id='oEo6l'></tbody>
                <bdo id='oEo6l'></bdo><ul id='oEo6l'></ul>

              • <legend id='oEo6l'><style id='oEo6l'><dir id='oEo6l'><q id='oEo6l'></q></dir></style></legend>

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

                1. <i id='oEo6l'><tr id='oEo6l'><dt id='oEo6l'><q id='oEo6l'><span id='oEo6l'><b id='oEo6l'><form id='oEo6l'><ins id='oEo6l'></ins><ul id='oEo6l'></ul><sub id='oEo6l'></sub></form><legend id='oEo6l'></legend><bdo id='oEo6l'><pre id='oEo6l'><center id='oEo6l'></center></pre></bdo></b><th id='oEo6l'></th></span></q></dt></tr></i><div id='oEo6l'><tfoot id='oEo6l'></tfoot><dl id='oEo6l'><fieldset id='oEo6l'></fieldset></dl></div>
                  本文介绍了何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以,我的 PYTHONPATH 定义中缺少一个分号.但这只是让我到目前为止.出于某种原因,直到我将 PYTHONPATH 中的目录显式添加到脚本的顶部,我的脚本才作为计划任务运行(在 WinXP 上).

                  So, it turned out i was missing a semi-colon from my PYTHONPATH definition. But this only got me so far. for some reason, my script did NOT work as a scheduled task (on WinXP) until I explicitly added a directory from PYTHONPATH to the top of my script.

                  问题是:我什么时候需要显式地在路径中附加一些东西,什么时候可以简单地依赖环境变量?

                  Question is: When do I need to explicitly append something to my path and when can I simply rely on the environment variables?

                  推荐答案

                  也许您没有在正确的凭据(登录名)下运行计划任务.在系统属性"对话框中定义环境变量时,它们可以是用户级或系统级.如果您将 PYTHONPATH 定义为用户级别,那么您的计划任务必须以该用户身份运行才能正确设置.我相信将其设为系统级别意味着它将适用于所有用户,除非他们定义了自己的价值.

                  Perhaps you're not running the scheduled task under the right credentials (log-in name). When you define environment variables in System Properties dialog, they can be either User-level or System-level. If you defined PYTHONPATH as User-level then your scheduled task must run as that user for it to be set properly. I believe making it System-level would mean it would apply to all users unless they have their own value defined.

                  下面是一个屏幕截图,显示了设置环境变量的位置.它在 Windows XP 和 Windows 7 中都类似.右侧对话框的上半部分显示当前的用户级设置,下半部分列出所有系统级设置.

                  Below is a screenshot showing where one sets environment variables. It's similar in both Windows XP and Windows 7. The top half of the right-hand dialog box shows the current User-level settings, and the bottom half lists all the System-level ones.

                  如果 PYTHONPATH 出现在上层用户级别组的名称列表中,您可以通过首先删除相同名称和关联值中的一个,然后将其添加到下层系统级组中,从而有效地将其移动到另一个下层.为了节省一点打字,您可以编辑用户级变量 before 删除它,以便有机会首先复制其当前值,然后取消操作.这样,当您制作新系统级副本时,您就可以简单地将复制的值粘贴到其中.

                  If PYTHONPATH appears in the list of names in the upper User-level group, you can effectively move it to the other lower one by first deleting and then adding one of the same name plus associated value to the lower System-level set. To save a little typing, you can Edit the user-level variable before you Delete it to be given a chance to first copy its current value, then Cancel-out of the operation. That way, when you make the New System-level copy you'll be able to simply paste the copied value into it.

                  这篇关于何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中读写环境变量?)
                  Why can#39;t environmental variables set in python persist?(为什么python中设置的环境变量不能持久化?)

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

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

                          <tbody id='YswS1'></tbody>
                      1. <tfoot id='YswS1'></tfoot>

                      2. <legend id='YswS1'><style id='YswS1'><dir id='YswS1'><q id='YswS1'></q></dir></style></legend>
                          <bdo id='YswS1'></bdo><ul id='YswS1'></ul>