找不到命令go-安装Go后在Mac上 [英] Command not found go — on Mac after installing Go
问题描述
我想使用golang,但是我在运行go命令时遇到了麻烦.我安装了go1.5.2 darwin/amd64,但是当我运行命令go version
时,在终端zsh: command not found: go
中出现错误.我在bash配置文件中添加了路径export PATH=$PATH:/usr/local/go/bin
,但是仍然出现错误(我重新启动了终端btw).我已卸载并重新安装,但是没有运气.有人可以帮我解决这个问题吗?我不确定安装中是否有错误,但下载成功.如果不进行锻炼,我可能必须下载旧版本的go.
I want to use golang, but I'm having trouble running the go command. I installed go1.5.2 darwin/amd64, but when I run the command go version
, I get an error in the terminal zsh: command not found: go
. I added the path export PATH=$PATH:/usr/local/go/bin
to the bash profile, but I still get the error (I restarted the terminal btw). I uninstalled and reinstalled, but no luck. Can anybody help me troubleshoot this? I'm not sure if there was an error in the installation, but it downloaded ok. I may have to download an older version of go if this doesn't workout.
推荐答案
类似于上述评论中提到的 bjhaid :
Like bjhaid mentioned in the comments above:
之所以会这样,是因为您必须将PATH
添加到~/.zshrc
文件中.
This is happening because you must add your PATH
to your ~/.zshrc
file.
在~/.zshrc
中,应添加以下行:
export PATH=$PATH:/usr/local/go/bin
然后您应该为您的.zshrc
文件提供来源:
you should then source you .zshrc
file:
. ~/.zshrc
这篇关于找不到命令go-安装Go后在Mac上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!