英文:
How to add GoLand Go executable to Windows Path?
问题
我正在使用GoLand IDE,它集成了JetBrains的终端。在这个终端中,我可以轻松使用go
命令。
go version // 输出:go version go1.17.5 windows/amd64
但是当我在GitBash中尝试相同的命令时,回应是bash: go: command not found
。
请问在哪里可以找到可执行文件?
英文:
I'm just starting with Go, so of course I stumble on errors on every corner. Well not really, it's way better then when I started with Java. But there is one issue.
I'm using GoLand IDE from JetBrains, and within it's integrated terminal I can easily use go
command.
go version // Output: go version go1.17.5 windows/amd64
But when I try the same in GitBash the response is bash: go: command not found
.
Where to find the executable?
答案1
得分: 2
我记得我有一个适用于Windows的最好的文件搜索应用程序,并且刚刚输入了go.exe
。
文件很快被找到,就在我第一次启动项目时保存的地方,也就是在C:\Users\MY_USERNAME\sdk\go1.17.5\bin\
,这正是我需要保存在PATH变量中的内容。
所以对于那些不知道的人:
- 按下“Win”键
- 输入“env”
- 选择“编辑系统环境变量”
- 选择“环境变量”
- 在“系统变量”下的列表中双击“Path”
- 选择“新建”
- 粘贴你找到
go.exe
的目录的完整路径(在我的情况下是“C:\Users\MY_USERNAME\sdk\go1.17.5\bin\go.exe”或者简写为“%userprofile%\sdk\go1.17.5\bin”) - 点击几次“确定”
英文:
I remembered that I have the best File Search application there is for Windows and just typed in go.exe
.
The file was promptly and obviously found just where I had saved it when starting my first project, that is in C:\Users\MY_USERNAME\sdk\go1.17.5\bin\
which is exactly what I needed to save in the PATH variable.
So for those who don't know:
- press "Win" key
- type "env"
- select "Edit the system environment variables"
- select "Environment Variables"
- double-click "Path" in the list below "System variables"
- select "New"
- paste the whole path of the directory where you have found
go.exe
in (in my case "C:\Users\MY_USERNAME\sdk\go1.17.5\bin\go.exe" or "%userprofile%\sdk\go1.17.5\bin" for short and exportable) - click "OK" a few times
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论