【发布时间】:2017-03-27 14:17:14
【问题描述】:
在下面获取 $PATH 的 3 个场景:1) 从终端 2) 从 Python 从终端 3) 从 Python (IDLE) 启动
1) 在终端中:>> echo $PATH 指向 ~10-15 个位置列表
2) 在终端中运行 Python:
>> python
>> os.environ['PATH']
>> # I get the same list as in the first scenario. Expected
3) 现在我运行 python IDLE(所以,不要运行终端)
>> os.environ['PATH']
>> # I get different list of paths. much less locations comparing to 1 or 2 scenarios.
问:如何更改 $PATH 以影响 Python IDLE?我发现了一些从 .bash_profile 更新 $PATH 的建议,但看起来它们仅在我运行终端时才会影响 $PATH。
我也考虑过 /etc/paths,但仍然有一个位置 (/usr/loca/bin/) 在 3d 场景中丢失。那么 Mac OS X 中 $PATH 变量的来源是什么?
【问题讨论】:
-
这个问题应该有你要找的答案:stackoverflow.com/questions/25385934/…
标签: python macos environment-variables macos-sierra