2014-05-18 13:26 阅读 1.2k


我一直在尝试设置我的Go工作空间,但它似乎不工作。每当我输入 echo %GOPATH%, 并回应 C:Users\y\GoWorkspace. 但是只要我输入 go, 就会显示 go is not recognized as an internal or external command. 这对于任何其他的Go命令都是一样的。 我使用的是Windows 8 64位版本,Go 1.2.2是32位版本。我也尝试过1.2.2 64位,但没有任何改变。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    dongxkbjiaofea1163 dongxkbjiaofea1163 2014-05-18 13:38

    GOPATH is the path that go uses when you build or test go applications. It does not tell Windows where your go executable is. For this you have to set you path environment variable. You can also set your GOBIN environment variable.

    点赞 评论 复制链接分享
  • dongpa5277 dongpa5277 2014-05-19 01:35

    As @JohnGilmore has pointed out the GOPATH is the location the Go tools use (executables). To set the location to the go executable so that Windows can find the command you will need to set your PATH variable.

    On Windows:

    SET %PATH%=%PATH%;C:\Go\bin

    You can also set this so that it is in every new environment by typing 'env' into the Start->search and then choose 'Edit the system environment variables'.

    点赞 评论 复制链接分享