1. 下载protobuf源代码(当前最新版本为:2.5.0)
#cd /opt
#wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz python
2. 解压,编译,安装
#tar zxvf protobuf-2.5.0.tar.gz
#cd protobuf-2.5.0
#./configure
#make
#make check
#make install ui
3. 继续安装protobuf的python模块(若是不用python,可跳过这一步)
#cd ./python
#python setup.py build
#python setup.py test
#python setup.py install google
4. 安装完成,验证Linux命令
#protoc –version spa
5. 验证Python模块是否被正确安装
#python
>>>import google.protobuf
若是没有报错,说明安装正常。 code
Note: get
error: package directory 'google/protobuf/compiler' does not existio
解决办法:在google/protobuf/下建立compiler文件夹编译
再次在protobuf文件夹下运行:python setup.py install test