gpt4 book ai didi

linux - bash:python3.3 没有那个文件或目录

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:22:47 24 4
gpt4 key购买 nike

我最近安装了 python3.3.2 的/usr/local 副本,当确信它是可靠的时,在/usr 下重新安装并删除了/usr/local 版本。当我将可执行文件作为/usr/bin/python3.3 运行时,一切都很好,但是当我将它作为“python3.3”运行时,我收到消息:

> python3.3
bash: /usr/local/bin/python3.3: No such file or directory

'which' 找到/usr/bin/python3.3。我做了一个 'set -u' 和 'set echo' 试图弄清楚发生了什么但没有成功。 bash 是如何进入这里的?

谢谢。史蒂夫 S.

最佳答案

你的可执行文件仍然被 shell 记住,就好像它是用哈希完成的一样:

hash: hash [-lr] [-p pathname] [-dt] [name ...]
Remember or display program locations.

Determine and remember the full pathname of each command NAME. If
no arguments are given, information about remembered commands is displayed.

-r forget all remembered locations

运行 hash -r 无需重新启动 shell 即可解决此问题。

更新:实际上,shell 不仅通过运行哈希来记住它。也许当您尝试执行它或执行类似 type -P prog 的操作时,shell 已经记住了它。这是我在测试中遇到的错误,我没有运行 w:

bash: /usr/local/bin/w: No such file or directory

hash -r 修复了它。

关于linux - bash:python3.3 没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18725981/

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