Go不是内部或外部命令

I've been trying to set up my Go workspace, but it doesn't seem to be working. Whenever I type in echo %GOPATH%, it echoes C:Users\y\GoWorkspace. But whenever I type go, it says go is not recognized as an internal or external command. This is the same for any other Go command.

I am using Windows 8 64-bit with Go 1.2.2 32-bit. I have also tried Go 1.2.2 64-bit, but it didn't change anything.

展开翻译

译文

我一直在尝试设置Go工作区,但是它似乎没有用。 每当我键入 echo%GOPATH%</ code>时,它都会回显 C:Users \ y \ GoWorkspace </ code>。 但是,每当我键入 go </ code>时,都会说 go不被识别为内部或外部命令</ code>。 这与其他所有Go命令相同。</ p>

我正在使用Windows 8 64位和Go 1.2.2 32位。 我还尝试了64位Go 1.2.2,但没有任何改变。</ p>
</ div>

dsdtszi0520538
dsdtszi0520538 您是否已将安装位置添加到%PATH%?
接近 6 年之前 回复

2个回答

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.

展开翻译

译文



GOPATH是在构建或测试go应用程序时go使用的路径。 它不会告诉Windows go可执行文件在哪里。 为此,您必须设置路径环境变量。 您还可以设置GOBIN环境变量。</ p>
</ div>

dongyi7966
dongyi7966 现在可以正常工作了,我丢失了一个引号。
接近 6 年之前 回复
doufangzhang4454
doufangzhang4454 这不起作用,我在路径中添加了“ C:\ Go”,并将GOBIN设置为“ C:\ Go”
接近 6 年之前 回复

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'.

doudu6100
doudu6100 谢谢,问题是我缺少一个引号。
接近 6 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问