Flo*_*ain 2 installation go go-build
我只是按照 golang (ubuntu 16) 的安装指南进行操作。我在 /etc/usr 中提取了存档,在 /home/user/.profile 中添加了 env 变量,我刚刚在 hello world 代码上测试了基本的 go 构建。
我收到以下错误:
The program 'go' is currently not installed. You can install it by typing: sudo apt install golang-go
Run Code Online (Sandbox Code Playgroud)
为什么它要求我(再次?)安装它?
二进制文件的位置go不在您的路径中。Ubuntu 没有找到它并建议安装它。将此行添加到您的文件中/etc/profile,或者更好$HOME/.profile:
export PATH=$PATH:/usr/local/go/bin
Run Code Online (Sandbox Code Playgroud)
这在文档中有记录: https: //golang.org/doc/install#install
如果您想在编辑任何文件之前尝试此解决方案,您只需执行上述命令并尝试go在 shell 中执行该命令即可。
小智 6