python版protobuf 安装

1. 下载protobuf源代码(当前最新版本为:2.5.0) 
#cd /opt 
#wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz

2. 解压,编译,安装 
#tar zxvf protobuf-2.5.0.tar.gz 
#cd protobuf-2.5.0 
#./configure 
#make 
#make check 
#make install

3. 继续安装protobuf的python模块(如果不用python,可跳过这一步) 
#cd ./python 
#python setup.py build 
#python setup.py test 
#python setup.py install

4. 安装完成,验证Linux命令 
#protoc –version

5. 验证Python模块是否被正确安装 
#python 
>>>import google.protobuf 
如果没有报错,说明安装正常。

Note:

error: package directory 'google/protobuf/compiler' does not exist

解决办法:在google/protobuf/下创建compiler文件夹

再次在protobuf文件夹下运行:python setup.py install

猜你喜欢

转载自blog.csdn.net/weiqubo/article/details/80396104