python版protobuf安裝

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

相關文章
相關標籤/搜索