dsajkdadsa14222 2016-03-18 11:46
浏览 228
已采纳

Golang错误“找不到命令”

I'm trying to run golang in an interactive mode.

I want to use go-eval for that, I followed the README instructions:

  • I ran go get github.com/sbinet/go-eval/ successfully
  • I ran go-eval which resulted in -bash: go-eval: command not found

Some more information:

  • echo $PATH returns: /usr/local/go/bin:...

  • echo $GOPATH returns: $HOME/golang

  • running whereis go-eval returns no output

  • running go install go-eval returns:

    can't load package: package go-eval: cannot find package "go-eval" in any of: /usr/local/go/src/go-eval (from $GOROOT) $HOME/golang/src/go-eval (from $GOPATH)

  • 写回答

5条回答 默认 最新

  • doushan9415 2016-03-18 12:07
    关注

    You need to add GOPATH/bin to PATH.

    PATH="$GOPATH/bin:$PATH"
    

    Update: Starting with Go 1.8, GOPATH defaults to $HOME/go if not set. The above will not work if GOPATH is not explicitly set.

    To set both, add this to your .profile:

    export GOPATH="$HOME/go"
    PATH="$GOPATH/bin:$PATH"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 速帮,学校需要在外上班没空
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改
  • ¥15 Windows 系统cmd后提示“加载用户设置时遇到错误”
  • ¥50 vue router 动态路由问题
  • ¥15 关于#.net#的问题:End Function
  • ¥15 无法import pycausal
  • ¥15 VS2022创建MVC framework提示:预安装的程序包具有对缺少的注册表值的引用
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义