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

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

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

      1. <legend id='md5Ng'><style id='md5Ng'><dir id='md5Ng'><q id='md5Ng'></q></dir></style></legend>
      2. PYTHONPATH 被忽略

        PYTHONPATH ignored(PYTHONPATH 被忽略)

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

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

                <tfoot id='v7xwm'></tfoot>

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

                    <tbody id='v7xwm'></tbody>
                  本文介绍了PYTHONPATH 被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  环境:debian 4.0

                  Environment: debian 4.0

                  Python 2.4

                  我的项目"安装在:

                  /usr/lib/python2.4/site-packages/project.

                  /usr/lib/python2.4/site-packages/project.

                  但我想使用我的工作副本,而不是位于以下位置的已安装副本:

                  But I want to use my working copy instead of the installed one which is located in:

                  /home/me/dev/project/src

                  /home/me/dev/project/src

                  所以我要做的是:

                  导出 PYTHONPATH=/home/me/dev/project/src

                  export PYTHONPATH=/home/me/dev/project/src

                  ipython

                  import foo # 在 src 中

                  import foo # which is in src

                  foo.__file__

                  */usr/lib/python2.4/site-packages/project/foo.py*
                  

                  而不是:

                  /home/me/dev/project/src/project/foo.py

                  /home/me/dev/project/src/project/foo.py

                  怎么会?我尝试检查路径(已完成上面的导出),我看到的是:

                  How come? I try to check the pathes (having done the export above) and what I see is:

                  导入系统,操作系统

                  系统路径

                  ['','/usr/bin','/usr/lib/python2.4/site-packages','/home/me/dev/project/src','/usr/lib/python24.zip','/usr/lib/python2.4','/usr/lib/python2.4/plat-linux2','/usr/lib/python2.4/lib-tk','/usr/lib/python2.4/lib-dynload','/usr/local/lib/python2.4/site-packages','/usr/lib/python2.4/site-packages/PIL','/var/lib/python-support/python2.4','/usr/lib/python2.4/site-packages/IPython/Extensions','/home/me/.ipython']

                  os.environ['PYTHONPATH']

                  os.environ['PYTHONPATH']

                  /home/me/dev/project/src

                  推荐答案

                  根据 python 文档,这是预期行为:https://docs.python.org/2.4/lib/module-sys.html:

                  According to python documentation, this is expected behavior: https://docs.python.org/2.4/lib/module-sys.html:

                  注意脚本目录是插入的条目之前插入作为 PYTHONPATH 的结果.

                  Notice that the script directory is inserted before the entries inserted as a result of PYTHONPATH.

                  在 python-2.6 下是不同的:http:///docs.python.org/tutorial/modules.html#the-module-search-path

                  Under python-2.6 it is different: http://docs.python.org/tutorial/modules.html#the-module-search-path

                  这篇关于PYTHONPATH 被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)

                            <tbody id='478oo'></tbody>

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

                          <small id='478oo'></small><noframes id='478oo'>

                            <bdo id='478oo'></bdo><ul id='478oo'></ul>