Jump to content
IPS Community Suite 简体中文
Sign in to follow this  
ipscn

Not Found Golang On Ubuntu

Recommended Posts

运行

go run ./main.go

提示

uuu@uuu:~/go$ go run main.go

Command 'go' not found, but can be installed with:

sudo snap install go       
sudo apt  install golang-go
sudo apt  install gccgo-go 

See 'snap info go' for additional versions.

我明明已经安装了 Golang 的:

whereis go
uuu@uuu:~/go$ whereis go
go: /usr/local/go

难道是从 Ubuntu 16.04 升级到 18.04 之后,PATH 改变了?

uuu@uuu:~/go$ sudo echo $PATH
/home/uuu/bin:/home/uuu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

的确没有显示 Golang 的安装目录,加上

export PATH=$PATH:/usr/local/go/bin

再次执行 go 的命令,好了。

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×