安装beego和bee的方法,适用于不能科学上网情况下安装

由于网上安装beego和bee的方法大多都是这样的:

go get -u github.com/astaxie/beego
go get -u github.com/beego/bee

但是会因不能访问外网安装出错,所以有如下方法:

首先按照正常安装go的方式安装好go环境


https://github.com/astaxie/beego
https://github.com/beego/bee
下载好这俩文件夹:beego和bee

在安装的go配置的GOPATH目录下新建好如下路径:你的gopath路径\src\github.com\astaxie,粘贴
beego文件夹
你的gopath路径\src\github.com\beego粘贴bee文件夹

打开cmd,切到你的gopath路径\src\github.com\beego\bee目录下,执行go build
要是报这样的错误:

go: github.com/beego/beego/v2@v2.0.1: Get "https://proxy.golang.org/github.com/beego/beego/v2/@v/v2.0.1.mod": dial tcp 172.217.160.81:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

执行一下go env -w GOPROXY=https://goproxy.cn
再执行go build
在这里插入图片描述
完成后会在你的gopath路径\src\github.com\beego\bee目录下生成bee.exe文件,
新建你的gopath路径\binbee.exe复制过来

再在电脑的环境变量Path中追加%GOPATH%\bin

好了,重启cmd输入bee version

C:\Users\WorkLCJ>bee version
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.0.1

├── Beego     : Beego is not installed. Please do consider installing it first: https://github.com/beego/beego/v2. If you are using go mod, and you don't install the beego under $GOPATH/src/github.com/astaxie, just ignore this.
├── GoVersion : go1.14.13
├── GOOS      : windows
├── GOARCH    : amd64
├── NumCPU    : 8
├── GOPATH    : D:\Users\go
├── GOROOT    : C:\Program Files\GO
├── Compiler  : gc
└── Date      : Monday, 14 Dec 2020

看到这个便是完成了beego和bee安装


分隔线
linux下安装beego


下载go:

wget https://golang.google.cn/dl/go1.15.6.linux-amd64.tar.gz

解压至/usr/local目录:

tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz

配置环境变量:
vim /etc/profile,添加:

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

source /etc/profile,使修改生效

安装beego:

go get -v github.com/astaxie/beego

设置GOPROXY:

export GOPROXY=https://goproxy.io
export GO111MODULE=on

可成功安装:

go get -v github.com/beego/bee

执行:bee version可看到:
在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值