转自:http://www.tuicool.com/articles/VfQfM3

 

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-12-05
  • 2021-07-17
  • 2022-01-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-31
  • 2021-10-16
  • 2022-01-18
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案