Mac和Linux安装python的protobuf

protobuf安装

  • Mac安装protobuf
  • Linux安装protobuf


Mac安装protobuf

//安装
brew install protobuf
brew install autoconf automake libtool 

//验证
protoc --version
python
import google.protobuf

Linux安装protobuf

//下载protobuf源代码
下载地址https://github.com/google/protobuf/releases 
wget https://github.com/google/protobuf/releases/download/v3.6.1/protobuf-python-3.6.1.tar.gz

//解压,编译,安装
tar zxvf protobuf-python-3.6.1.tar.gz 
cd protobuf-3.6.1
./configure --prefix=/usr/local/protobuf-3.6.1
make 
make check 
make install

//继续安装protobuf的python模块
cd ./python 
python setup.py build 
python setup.py test 
python setup.py install

//安装完成,验证Linux命令
protoc –version

//验证Python模块是否被正确安装
python
import google.protobuf

你可能感兴趣的:(linux,mac)