【发布时间】:2012-07-24 22:13:20
【问题描述】:
>>> sys.path[6]
/path/to/django
>>> sys.path.pop(6)
/path/to/django
然后CTRL + D
$ python
>>> sys.path[6]
/path/to/django
亲爱的……
【问题讨论】:
-
任何其他变量的突变/绑定也是如此。为什么这令人惊讶?
-
那么如何从列表中永久删除此项目?
-
每次启动python时删除它..
-
我假设 sys 模块确保对该列表的更改也在 PYTHONPATH 中进行了调整。
-
@Bentley4 +1,我也是。在另一篇 Stack Overflow 文章中,一位名叫 Sergey 的用户谈到了这个主题
the change to sys.path is not permanent and only affects the current process. If you want to make a change system-wide you'll need to have a look inside the site-packages directory and do some changes. See the lnk to the site module documentation I linked above
标签: python path python-2.7 pythonpath