Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash can';重新安装后是否找不到ghc?_Bash_Haskell_Installation - Fatal编程技术网

Bash can';重新安装后是否找不到ghc?

Bash can';重新安装后是否找不到ghc?,bash,haskell,installation,Bash,Haskell,Installation,我刚刚重新安装了Haskell平台(),在重新安装Haskell平台后,我得到: Drews-MacBook-Pro:Blokus-AI drewgross$ ghc -bash: /usr/local/bin/ghc: No such file or directory 知道为什么吗?我怀疑这与我的道路或类似的东西有关,但我还没有发现任何奇怪的事情。我可以直接使用ghc: Drews-MacBook-Pro:Blokus-AI drewgross$ /usr/bin/ghc ghc: no

我刚刚重新安装了Haskell平台(),在重新安装Haskell平台后,我得到:

Drews-MacBook-Pro:Blokus-AI drewgross$ ghc
-bash: /usr/local/bin/ghc: No such file or directory
知道为什么吗?我怀疑这与我的道路或类似的东西有关,但我还没有发现任何奇怪的事情。我可以直接使用ghc:

Drews-MacBook-Pro:Blokus-AI drewgross$ /usr/bin/ghc
ghc: no input files
Usage: For basic information, try the `--help' option.
和/usr/bin/在我的路径中:

Drews-MacBook-Pro:Blokus-AI drewgross$ echo $PATH
/Users/drewgross/.rvm/gems/ruby-1.9.3-p327/bin:/Users/drewgross/.rvm/gems/ruby-1.9.3-p327@global/bin:/Users/drewgross/.rvm/rubies/ruby-1.9.3-p327/bin:/Users/drewgross/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

我还能做什么?

您的
$PATH
中的一个目录有一个可执行符号链接,指向不再存在的
/usr/local/bin/ghc
。要查找,请在bash中键入
哪个ghc
。如果结果确实是一个符号链接,只需删除它。如果是自定义脚本,您可能希望重命名它,而不是删除它,以防以后需要它。

shell将缓存您以前使用过的命令的路径。使用
which ghc
不会显示此情况(因为它位于shell外部,只查询
路径
),但是
type
是一个
bash
-内部命令,将显示此情况,因此
type ghc
将显示如下内容

ghc is hashed (/usr/local/bin/ghc)

修复很容易。要么启动一个新的shell(从零开始),要么通过说
hash-r

symlink
/usr/local/bin/ghc
/usr/bin/ghc
来清除缓存。这听起来像是一个难看的黑客攻击,虽然我想它会起作用,但我更愿意避免类似的东西,基本的命令是
键入ghc
。您的shell可能缓存了旧的
ghc
路径。在
bash
中,您可以执行
hash-r
来清除缓存。或者你可以开始一个新的shell。@kosmikus解决了我的问题,谢谢!“如果你想回答这个问题,我会接受的。”德鲁很高兴它解决了你的问题。我补充了一个答案。