【问题标题】:OSX: Setting Enthought python path in .bash_profile results in weird terminal behaviorOSX:在 .bash_profile 中设置 Enthought python 路径会导致奇怪的终端行为
【发布时间】:2014-05-06 11:28:17
【问题描述】:

我按照knowledge base 将其添加到 .bash_profile 中

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

当我重新启动终端时,许多功能不再起作用:

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

但是,enpkg 和 cd 似乎仍然是可调用的。如果我删除那部分,东西会再次起作用。有人对正在发生的事情有任何见解吗?我只想让 enpkg 运行...

【问题讨论】:

    标签: python macos bash terminal enthought


    【解决方案1】:

    您重置了PATH,而不是添加到它,所以bash 不知道除了您指定的单个目录之外的任何地方可以查找命令。相反,使用其中之一

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

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

    您使用两个分配中的哪一个取决于您是否希望新目录成为 shell 查找命名命令的第一个或最后一个位置。

    enpkg实际上在那个目录中,而cd是shell内置命令,不是外部程序,所以不涉及路径查找。

    【讨论】:

      猜你喜欢
      • 2014-08-23
      • 1970-01-01
      • 2021-12-12
      • 2013-10-14
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 2013-10-06
      相关资源
      最近更新 更多