python安装protobuf包
sudo pip2 install protobuf==2.5.0
github克隆获取安装包
wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
解压并进入该目录
tar -zxvf Protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
配置安装环境
sudo apt-get install autoconf automake libtool curl make g++ unzip
git clone https://github.com/google/protobuf.git
开始安装
./configure
make
make check
sudo make install
配置protobuf环境
sudo vim /etc/profile
文件末尾加上两行
export PATH=/usr/local/protoc/bin:$PATH
export PATH=/usr/local/protoc/include:$PATH
更新配置
source /etc/profile
配置动态链接库
sudo vim /etc/ld.so.conf
新加一行:
/usr/local/protobuf/lib
执行如下命令:
ldconfig
确认安装成功
protoc --version