【发布时间】:2011-12-28 11:43:49
【问题描述】:
我无法设置 PYTHONPATH。我已将此行添加到 ~/.bashrc
export PYTHONPATH=$PYTHONPATH:/home/sayth/My_Programs/Python
我跑了source ~/.bashrc
这就是问题所在,但如果我在终端输入 python 并获得一个 python REPL,我就可以毫无问题地从 ~/My_Programs/Python 导入模块。
但是,如果我在 ninja-ide 等中运行 bpython 或 idle 或控制台,则导入失败。
>>> import temperature
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import temperature
ImportError: No module named temperature
>>>
我可以执行 sys.path.append(/home/sayth/My_Programs/Python) 并让它工作,但我希望 PYTHONPATH 能够自动在所有控制台中工作。怎么样?
PS 使用 ubuntu 11.10
【问题讨论】:
标签: python ubuntu path terminal environment-variables