2016-11-14 63 views
2

3方案,以获得低于$ PATH: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变量的来源是什么?

+0

这个问题应该有你正在寻找的答案:http://stackoverflow.com/questions/25385934/setting-environment-variables-via-launchd-conf-no-longer-works-in-os-x-优胜美地 –

回答

1

变量$ PATH由.bash_profile更改,它在启动终端时执行。在你的情况下,你应该通过例如苹果工具path_helper编辑/etc/paths.d/(见here)。

+0

我想你错过了这个问题。 IDLE输出不同的信息 –

+0

因此,实际上path_helper在Python IDLE不打印时打印'/ usr/local/bin /'。这是否意味着Python IDLE具有自己的设置或加载了/ etc /路径,但是通过其他设置删除了一些位置? –

+1

变量'PATH'通常由'.bash_profile'设置,但这只适用于在终端中运行的程序,并且只有在您的shell设置为Bash的情况下。 –

相关问题