1.控制台查看是否存在 bash_profile文件
cd~/.bash_profile
2.在该文件中增加环境变量
(1)打开
vim~ /.bash_profile
(2)插入模式
i
(3)输入
#GOROOT
exportGOROOT=/usr/local/go
#GOPATH
exportGOPATH=$HOME/Documents/go_workspace
#GOROOT bin
exportPATH=$PATH:$GOROOT/bin
#GOPATH bin
exportPATH=$PATH:$GOPATH/bin
3.执行该文件
$source.bash_profile
网友评论