在MAC下安装Go环境和beego

“学习或者了解人工智能小伙伴福利来了,前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。”

想了解或者学习人工智能可以看一下,我觉得学习起来挺有趣的!!!!
点击跳转到网站
在这里插入图片描述

在这里插入图片描述

MAC安装go的环境

下载go给出一个下载地址:

go下载链接

mac电脑使用这个版本的就好了
在这里插入图片描述
下载之后我们按照步骤安装即可

测试

go version 

在这里插入图片描述

配置环境变量

创建GOPATH

系统自己建了一个go的目录,在我们的用户目录下
在这里插入图片描述
修改环境变量配置文件

vim ~/.bash_profile

添加配置

export GOPATH=${HOME}/go
export PATH=${PATH}:${GOPATH}/bin

在这里插入图片描述
应用配置文件

source ~/.bash_profile

Usage

[Go 1.13 and above (RECOMMENDED)](https://goproxy.cn/#Go 1.13 and above (RECOMMENDED))

Open your terminal and execute

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

done.

[macOS or Linux](https://goproxy.cn/#macOS or Linux)

Open your terminal and execute

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

or

echo "export GO111MODULE=on" >> ~/.profile
echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
source ~/.profile

done.

Windows

Open your terminal and execute

C:\> $env:GO111MODULE = "on"
C:\> $env:GOPROXY = "https://goproxy.cn"

or

1. Open the Start Search, type in "env"
2. Choose the "Edit the system environment variables"
3. Click the "Environment Variables…" button
4. Under the "User variables for <YOUR_USERNAME>" section (the upper half)
5. Click the "New..." button
6. Choose the "Variable name" input bar, type in "GO111MODULE"
7. Choose the "Variable value" input bar, type in "on"
8. Click the "OK" button
9. Click the "New..." button
10. Choose the "Variable name" input bar, type in "GOPROXY"
11. Choose the "Variable value" input bar, type in "https://goproxy.cn"
12. Click the "OK" button

done.

如果您使用的 Go 版本是 1.13 及以上 (推荐)

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct

# 设置不走 proxy 的私有仓库,多个用逗号相隔(可选)
go env -w GOPRIVATE=*.corp.example.com

# 设置不走 proxy 的私有组织(可选)
go env -w GOPRIVATE=example.com/org_name

设置完上面几个环境变量后,您的 go 命令将从公共代理镜像中快速拉取您所需的依赖代码了。私有库的支持请看这里

如果您使用的 Go 版本是 1.12 及以下

Bash (Linux or macOS)

# 启用 Go Modules 功能
export GO111MODULE=on
# 配置 GOPROXY 环境变量
export GOPROXY=https://goproxy.io

或者,根据文档可以把上面的命令写到.profile.bash_profile文件中长期生效。

PowerShell (Windows)

# 启用 Go Modules 功能
env:GO111MODULE="on"
# 配置 GOPROXY 环境变量
env:GOPROXY="https://goproxy.io"

现在,当你构建或运行你的应用时,Go 将会通过 goproxy.io 获取依赖。更多信息请查看 使用指引

安装beego

go get github.com/astaxie/beego

在这里插入图片描述
输入这个命令之后感觉等待了一万年

解决go get 很慢问题

解决这个问题,打开hosts文件,加上这两段

192.30.253.112 github.com
151.101.185.194 github.global.ssl.fastly.net

在这里插入图片描述

安装bee

go get github.com/beego/bee

测试

bee version

在这里插入图片描述
在这里插入图片描述

  • 39
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

行走的皮卡丘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值