Beego安装

一、windows 安装步骤:
1.下载并安装好GO并配置好GOROOT和GOPATH环境变量(用msi包安装的go,环境变量已自动设置完成),并在Path环境变量中加入:

%GOPATH%\bin %GOROOT%bin。

2.可以管理员命令运行cmd,使用命令:
go get github.com/beego/bee

即可以安装bee。也可以打开github shell(安装git,使用git的shell),执行:
go get github.com/beego/bee

如果出现以下报错:
# cd .; git clonehttps://github.com/beego/bee e:\go\src\github.com\beego\beeCloning into'e:\go\src\github.com\beego\bee'...fatal: unable to access 'https://github.com/beego/bee/':Could not resolve host: github.compackage github.com/beego/bee: exit status128

【Beego安装】解决方法:
执行: gitconfig --global http.sslVerify false然后再执行:go get github.com/beego/bee

即可以通过。
然后可以在cmd命令窗口或者gitshell再执行下面命令:
go get github.com/astaxie/beego

注意:这里必须用GO命令去下载beego的程序,这样下载的程序才比较全,我开始用githu客户端下载,结果这个程序是运行 不了的。
如果执行过程中出现以下错误:
"can't load package:package github.com/astaxie/beego:no buildable Go source files in E:\Go\src\github.com\astaxie\beego"

则使用命令:
go get -u -v github.com/astaxie/beego

看看进度和详细情况。本人在安装过程执行改命令提示goroot和gopath有包冲突,本人直接删掉goroot下的astaxie包(可能是误操作把包安装到goroot下)。删掉后重新执行命令就可以了。
如果使用go get 命令无法安装astaxie包,可以直接到github下载,修改文件名,放置到gopath的src目录下即可。使用goland编译器引入github.com/astaxie/beego 包时,能够自动识别到,说明该方式有效。
二、Linux下安装Beego
1.linux下安装和windows命令一样,参考上面命令。
2.在这个过程中可能遇到的问题:
在安装过程中可能会报下面的错误提示:
go install: cannot install cross-compiled binaries when GOBIN is set

遇到这个问题一般是在环境变量中设置了 GOBIN 可以打开 /etc/profile 把这个变量注释掉就,执行 source /etc/profile生效即可同样安装完成之后需要在环境变量中追加bee的路径
在 /etc/profile 文件中追加:
export PATH=$GOPATH/bin:$PATH

之后执行:
source /etc/profile //生效

可能遇到的问题:添加之后执行bee不成功。
查看bee的所在路径 :
echo $GOPATH //获取GOPATH的路径

本人是在/home/chun/go:
find /home/chun/go -name "bee"

输出:
/home/chun/go/bin/linux_386/bee /home/chun/go/src/github.com/beego/bee /home/chun/go/pkg/linux_386/github.com/beego/bee

这里可以看到我的linux系统上bee的安装路径和正常不一样,在linux_386下面,接下来只需把/home/chun/go/bin/linux_386添加到环境变量就ok了。
export PATH=$GOPATH/bin/linux_386:$PATH source /etc/profile



    推荐阅读