go语言学习-beego框架学习bee在windows和linux下的安装

windows下的安装

  • windows下的安装和linux下其实是相同的命令
go get github.com/beego/bee
//或者使用
go install github.com/beego/bee

在windows下安装完成之后需要在 环境变量中加入bee的路径%GOPATH%\bin
这样做的好处是在任何地方都可以使用 bee 工具
填加完成之后再命令行界面输入 bee看有没有成功,成功的话如下:

Bee is a Fast and Flexible tool for managing your Beego Web Application.

USAGE
    bee command [arguments]

AVAILABLE COMMANDS

    version     Prints the current Bee version
    migrate     Runs database migrations
    api         Creates a Beego API application
    bale        Transforms non-Go files to Go source files
    fix         Fixes your application by making it compatible with newer versions of Beego
    dlv         Start a debugging session using Delve
    dockerize   Generates a Dockerfile for your Beego application
    generate    Source code generator
    hprose      Creates an RPC application based on Hprose and Beego frameworks
    new         Creates a Beego application
    pack        Compresses a Beego application into a single file
    rs          Run customized scripts
    run         Run the application by starting a local development server
    server      serving static content over HTTP on port

Use bee help [command] for more information about a command.

ADDITIONAL HELP TOPICS


Use bee help [topic] for more information about that topic.
如果没有成功重启电脑看行不行,一般重启后就会生效

Linux下的安装

  • linux下安装和windows命令一样,这里就不写了

可能遇到的问题:

  • 在安装过程中可能会报下面的错误提示: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

这样就OK了,如果还有问题欢迎留言

猜你喜欢

转载自blog.csdn.net/len_yue_mo_fu/article/details/81079398