douhong6187 2018-03-28 14:26
浏览 82

Windows 10 golang安装程序。 错误,不在环境中

I am running into issues setting up go for the first time on a Windows 10 machine.

I followed the instructions from the install.

When I CD to my project E:\goProjects\goWebApp\src and run go build, I receive the following error.

C:\windows\system32>go version
Not in an environment
C:\Users\MyUser~1\AppData\Local\Temp\go_there.bat' is not recognized as an internal or external command,
    operable program or batch file.

My system variables are as follows:

  • GOPATH=E:\goProjects\goWebApp
  • GOROOT=C:\Go
  • PATH=C:\Go\bin

If I run go version from C:\Go\bin everything works fine. Running go command from anywhere outside of this directory does not work. I have also tried restarting my cmd prompt and restarting my computer. Still no luck. Has anyone else ran into this issue? Or know what I might have done wrong?

enter image description here

  • 写回答

1条回答 默认 最新

  • dpyln64620 2018-03-28 15:57

    Turns out I had two go locations in my PATH (sort of). When I ran the command where go from command prompt two paths were returned.

    Something like this..


    There apparently was a bat file in devTools\bin called go.bat. This was unrelated to golang itself, just coincidental naming unfortunately.This was executing instead of the go binary, which in return was throwing the random error with the Not in an environment message.

    To fix the issue I just removed the devTools path from my PATH variable for now.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 如何使用chatgpt完成文本分类任务?
  • ¥15 已知速度v关于位置s的等式,怎么转化为已知位置求速度v的等式
  • ¥15 我有个餐饮系统,用wampserver把环境配置好了,但是后端的网页却进去,是为什么,能不能帮远程一下?
  • ¥15 R运行没有名称为"species"的插槽对于此对象类"SDMmodelCV"
  • ¥20 基于决策树的数字信号处理,2ask 2psk 2fsk的代码,检查下报错的原因
  • ¥20 python作业求过程
  • ¥15 wincc已组态的变量过多
  • ¥60 如图:直线与椭圆X轴平行,求直线与椭圆任意一点的相切坐标计算公式
  • ¥50 如何用python使用opencv里的cv::cudacodec::VideoWriter函数对视频进行GPU硬编码
  • ¥100 c#solidworks 二次开发 工程图自动标边线法兰 等折弯尺寸怎么标