ubuntu安装golang

看版本:https://go.dev/dl/

下载:

wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz

卸载已有的go,可以apt remove go,也可以which go之后删除那个go文件,然后:

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz

再然后:

Add /usr/local/go/bin to the PATH environment variable.
You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):

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

重启终端后:
在这里插入图片描述

你可能感兴趣的:(Go语言,1024程序员节)