protobuf安装方式2种
要想用go语言使用protobuf这个工具,必须先下载protobuf的软件,再下载go操作protubuf的接口-API;
先安装了protubuf,系统变量就有了protoc工具,然后再安装go-api,就可以用go操纵protobuf。具体的实现我没研究。
一、下载protobuf
方法一:===> git clone https://github.com/protocolbuffers/protobuf.git
方法二:===> 或者将准备好的压缩包进行拖入
解压
Unzip protobuf1.zip
二、安装(Linux Ubuntu)
(1)安装依赖工具(联网)
$ sudo apt-get install autoconf automake libtool curl make g++ unzip libffi-dev -y
(2)进入protobuf文件
cd protobuf/
(3)进行安装检测 并生成自动安装脚本
./autogen.sh
./configure
(4)进行编译C代码
make
(5)进行安装
sudo make install
(6)刷新linux共享库关系
sudo ldconfig
三、测试protobuf编译工具
protoc -h
如果正常输出 相关指令 没有报任何error,为安装成功
四、获取 golang语言的proto包
(1)下载
方法一:===> go get -v -u github.com/golang/protobuf/proto
方法二:===>或者将 github.com-golang-protobuf.zip拖入 进行解压到 $GOPATH/src/github.com/golang
(2)进入到文件夹内进行编译
$ cd $GOPATH/src/github.com/golang/protobuf/protoc-gen-go
$ go build
(3)将生成的 protoc-gen-go可执行文件,放在/bin目录下
$ sudo cp protoc-gen-go /bin/
(4)尝试补齐protoc-gen-go 如果可以补齐代表成功,如果执行不报错 代表工具成功
=============================安装方式二 笨笨讲的 protobuf环境安装================================================================
一、protobuf 编译工具安装
1、下载 protoBuf:
git clone https://github.com/protocolbuffers/protobuf.git
2、或者直接将压缩包拖入后解压
unzip protobuf.zip
3、安装依赖库
sudo apt-get install autoconf automake libtool curl make g++ unzip libffi-dev -y
4、进入目录
cd protobuf/
5、自动生成configure配置文件:
./autogen.sh
6、配置环境:
./configure
7、编译源代码(时间比较长):
make
8、安装
sudo make install
9、刷新共享库 (很重要的一步啊)
sudo ldconfig
10、成功后需要使用命令测试
protoc -h
二。protobuf 的 go 语言插件安装 由于protobuf并没直接支持go语言需要我们手动安装相关插件
1获取 proto包
Go语言的proto API接口
go get -v -u github.com/golang/protobuf/proto
go get -v -u github.com/golang/protobuf/protoc-gen-go
2编译
cd $GOPATH/src/github.com/golang/protobuf/protoc-gen-go/
go build
3将生成的 protoc-gen-go可执行文件,放在/bin目录下
sudo cp protoc-gen-go /bin/
- ubuntu14.04下caffe protobuf问题的解决和安装方式
- caffe安装过程中与protobuf相关的问题
- protobuf的安装和卸载
- 安装pydot、protobuf、graphviz并查看版本(包括libprotoc)
- PHP中使用Protobuf简介以及安装使用
- 安装caffe以及和anaconda3 python3 import时关于protobuf版本不同的问题
- Ubuntu下protobuf的安装、编译及注意事项
- linux下安装protobuf教程
- 安装 protobuf 很水 慎入 主要做个备份
- 安装protobuf及相关的lua生成器
- linux下Google的Protobuf安装及使用笔记
- php安装protobuf 扩展
- 安装protobuf到Ubuntu14.04
- linux 安装protobuf2.5
- centos6.5 64位 protobuf和protobuf-c源文件编译&安装
- 安装protobuf可能遇到的问题
- google protobuf编译安装(ImportError: No module named google.protobuf.internal)
- protobuf-2.5.0.tar.gz的下载与安装
- caffe支持pycaffe的安装:ImportError: No module named google.protobuf.internal
- google protobuf编译安装(ImportError: No module named google.protobuf.internal)