“which”即使运行也找不到可执行文件的位置

Ony*_*nye 5 path which

背景

我登录服务器进行科学计算。它运行“科学 Linux 7.4 版”。

为了访问不同的软件,我必须运行像“模块加载 x”这样的命令。例如,要使用 python,我需要编写“模块加载 python”。我对这个模块系统了解不多,但据我所知,它只是修改了一些环境变量。输入“module show python”显示

module-whatis    This module sets up PYTHON 3.6 in your environment.
conflict         python
append-path      MODULEPATH /global/software/sl-7.x86_64/modfiles/python/3.6
setenv           PYTHON_DIR /global/software/sl-7.x86_64/modules/langs/python/3.6
prepend-path     PATH /global/software/sl-7.x86_64/modules/langs/python/3.6/bin
prepend-path     CPATH /global/software/sl-7.x86_64/modules/langs/python/3.6/include
prepend-path     FPATH /global/software/sl-7.x86_64/modules/langs/python/3.6/include
prepend-path     INCLUDE /global/software/sl-7.x86_64/modules/langs/python/3.6/include
prepend-path     LIBRARY_PATH /global/software/sl-7.x86_64/modules/langs/python/3.6/lib
prepend-path     PKG_CONFIG_PATH /global/software/sl-7.x86_64/modules/langs/python/3.6/lib/pkgconfig
prepend-path     MANPATH /global/software/sl-7.x86_64/modules/langs/python/3.6/share/man
Run Code Online (Sandbox Code Playgroud)

当我加载 python 时,我也可以访问 conda(其可执行文件位于 /global/software/sl-7.x86_64/modules/langs/python/3.6/bin)。

问题

通常我不能在没有先加载 python 模块的情况下运行 conda。但最近我注意到这发生了变化,现在我可以在不加载 python 模块的情况下运行 conda。这让我很困惑,所以我输入了“which conda”来查看是否可以找到正在运行的可执行文件,但是当我这样做时,它说在我的 PATH 变量上的任何目录中都找不到 conda。

尽管我仍然可以运行 conda,但“which”怎么可能找不到 conda 可执行文件?

G-M*_*ca' 16

您可能有一个名为“ conda”的别名或 shell 函数。类型

type conda
Run Code Online (Sandbox Code Playgroud)

看看说了什么。

  • 除非你确定 `which` 是你正在使用的 shell 中的一个内置参数,否则最好避免它。如果您使用 bash,内置 `type` 的 `-a` 选项/标志也很有用。 (5认同)