gpt4 book ai didi

Bash:哪个 返回的位置与预期的不同

转载 作者:行者123 更新时间:2023-11-29 09:23:38 25 4
gpt4 key购买 nike

谁能向我解释为什么会发生以下情况?

[$] pip
-bash: /usr/local/bin/pip: No such file or directory
[$] which pip
/bin/pip

最佳答案

应用程序查找被缓存。重置 pip 条目:

hash pip

引用man bash:

If the name is neither a shell function nor a builtin, and contains no slashes, bash searches each element of the PATH for a directory containing an executable file by that name. Bash uses a hash table to remember the full pathnames of executable files (see hash under SHELL BUILTIN COMMANDS below). A full search of the directories in PATH is performed only if the command is not found in the hash table.

以及同一文档中的 hash 条目:

hash [-lr] [-p filename] [-dt] [name]
For each name, the full file name of the command is determined by searching the directories in $PATH and remembered.

which 始终搜索您的路径,而不管哈希条目如何。

关于Bash:哪个 <app> 返回的位置与预期的不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27465881/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com