python 安装protobuf

安装准备:python和protoc(编译proto到各个语言)

下载protobuf源代码(各种语言实现):https://github.com/google/protobuf 

1、到Python目录,编译 
python setup.py build 
python setup.py install 
python setup.py test

2、验证安装是否成功

  #python 
  >>>import google.protobuf 

如果报错,检查错误。如果是protoc没找到,可以到./src下编译出protoc,或者直接下载protoc-3.2.0-win32 release版(https://github.com/google/protobuf/releases),把protoc被放到./src. 

猜你喜欢

转载自www.cnblogs.com/yang842718540/p/9198933.html