linux下安装protoc

protobuf 是做什么的

专业的解答:
Protocol Buffers 是一种轻便高效的结构化数据存储格式,可用于结构化数据串行化,很适合做数据存储或 RPC 数据交换格式。它可用于通讯协议、数据存储等领域的语言无关、平台无关、可扩展的序列化结构数据格式。简单的说就是干和xml一样的事,把某种数据结构的信息,以某种格式保存起来。主要用于数据存储、传输协议格式等场合

protobuf 如何安装

下载安装包

1、首先确定自己当前linux版本(当前版本为x86_64)

uname -a
Linux localhost.localdomain 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

下载地址:GitHub

2、选择相应的版本下载并解压到当前目录

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.0/protoc-3.15.0-linux-x86_64.zip

unzip protoc-3.15.0-linux-x86_64.zip

安装

解压protoc压缩包后,可以看到 readme.txt文件

Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
https://developers.google.com/protocol-buffers/

This package contains a precompiled binary version of the protocol buffer
compiler (protoc). This binary is intended for users who want to use Protocol
Buffers in languages other than C++ but do not want to compile protoc
themselves. To install, simply place this binary somewhere in your PATH.

If you intend to use the included well known types then don't forget to
copy the contents of the 'include' directory somewhere as well, for example
into '/usr/local/include/'.

Please refer to our official github site for more installation instructions:
  https://github.com/protocolbuffers/protobuf

大致意思是安装protoc,只需将bin目录下的二进制文件放在某个位置就行,比如放到自己的ananconda环境的bin下。如果你打算用其中的包含的其他类型,同时需要将include目录的内容也复制到某个地方,比如自己的annconda环境的include下

如果我们把bin下的protoc放在/usr/local/bin可执行程序目录中,这样全局都可以访问到,同时把include目录的内容也复制到/usr/local/include/中

# 移动安装protoc (cd到解压目录bin中后执行)
mv protoc /usr/local/bin

# 把`include`目录的内容复制(cd到解压目录include中后执行)
cp google /usr/local/include
protoc --version
libprotoc 3.15.0

refer:添加链接描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值