Golang安装 [英] Golang installation
问题描述
我刚刚遵循了golang的安装指南(ubuntu 16). 我在/etc/usr中解压缩了档案 我在/home/user/.profile中添加了env变量 我刚刚在hello世界代码上测试了基本的go构建.
I just followed the installation guide for golang (ubuntu 16). I extracted the archive at /etc/usr I added env variable in /home/user/.profile I just tested a basic go build on the hello world code.
我收到以下错误:
The program 'go' is currently not installed. You can install it by typing: sudo apt install golang-go
为什么再次要求我安装它?
Why does it ask me to install it (again?)?
推荐答案
二进制文件go
的位置不在您的路径中. Ubuntu找不到它,建议安装它.将此行添加到文件/etc/profile
或更好的$HOME/.profile
:
The location of the binary go
is not in your path. Ubuntu does not find it and suggests to install it. Add this line to your file /etc/profile
, or better $HOME/.profile
:
export PATH=$PATH:/usr/local/go/bin
这已在文档中记录: https://golang.org/doc/install#install
如果要在编辑任何文件之前尝试此解决方案,则只需执行以上命令并尝试在Shell中执行go
命令即可.
If you want to try this solution before editing any files, you can just execute the above command and try to execute the go
command in the shell.
这篇关于Golang安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!