简体   繁体   English

OSX:在.bash_profile中设置Enthought python路径会导致奇怪的终端行为

[英]OSX: Setting Enthought python path in .bash_profile results in weird terminal behavior

I followed the knowledge base on adding this to the .bash_profile 我遵循将其添加到.bash_profile的知识库

PATH="~/Library/Enthought/Canopy_64bit/User/bin"
export PATH

When I then restart the Terminal, a lot of functions do not work anymore: 然后,当我重新启动终端时,许多功能不再起作用:

X:~ excuvator$ ls
-bash: ls: command not found
X:~ excuvator$ security
-bash: security: command not found
X:~ excuvator$ sudo
-bash: sudo: command not found

However, enpkg and cd still seem to be callable. 但是,enpkg和cd似乎仍然可以调用。 If I remove that part, stuff works again. 如果我删除了那部分,东西又可以工作了。 Does anyone have any insight to what is happening? 有人对正在发生的事情有任何见识吗? I just want to get enpkg running... 我只想让enpkg运行...

You reset PATH , rather than adding to it, so bash doesn't know any place to look for commands other than the single directory you specified. 您重置PATH ,而不是添加它,因此bash除了指定的单个目录外,不知道查找命令的任何地方。 Instead, use one of 而是使用以下方法之一

PATH=$PATH:~/Library/Enthought/Canopy_64bit/User/bin

or 要么

PATH=~/Library/Enthought/Canopy_64bit/User/bin:$PATH

Which of the two assignments you use depends on whether whether you want the new directory to be the first or last place the shell looks for a named command. 使用两种分配方式中的哪一种取决于您是否希望新目录成为外壳程序查找命名命令的第一个位置还是最后一个位置。

enpkg actually is in that directory, and cd is a shell built-in command, not an external program, so no path lookup is involved. enpkg实际上在该目录中,并且cd是一个shell内置命令,不是一个外部程序,所以没有路径查找参与。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM