MacOS Sierra:全球修改$ PATH

时间:2016-11-14 00:29:39

标签: python macos environment-variables macos-sierra

获得$ PATH的3个场景:1)来自终端2)来自Python 3(终端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(所以,不要运行Terminal)

>> 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变量的来源是什么?

1 个答案:

答案 0 :(得分:1)

变量$ PATH由.bash_profile更改,在启动终端时执行。在您的情况下,您应该通过Apple工具/etc/paths.d/编辑path_helper(请参阅here)。