新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
CentOS6.5下Python版本的ProtoBuf編譯及安裝
因為要學習faster r-cnn,在搭建環(huán)境的時,發(fā)現(xiàn)原本通過yum安裝的protobuf沒有安裝python版本以及其他一系列版本版本兼容性問題,導致我必須用編譯方式重新安裝protobuf2.5

下載源碼
首先,從github上下載protobuf的源碼,地址:https://github.com/google/protobuf,我選擇下載2.5.0版本。
編譯protobuf
然后將下載的壓縮包解壓縮
unzip protobuf-2.5.0.zip
autogen.sh代碼片段
# Check that gtest is present. Usually it is already there since the
# directory is set up as an SVN external.
# 判斷是否存在gtest目錄
if test ! -e gtest; then
echo "Google Test not present. Fetching gtest-1.5.0 from the web..."
#如果目錄不存在則嘗試從google.com下載并解壓縮,如果google被墻則下載失敗
curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx
#將解壓縮后的目錄改名為gtest
mv gtest-1.5.0 gtest
fi
googletest1.5.0可以到主機寶貝資源站下載:
具體下載目錄在 /2017年資料/3月/27日/CentOS6.5下Python版本的ProtoBuf編譯及安裝/
#解壓縮
unzip gtest-1.5.0.zip
mv gtest-1.5.0 gtest
執(zhí)行protobuf編譯
#執(zhí)行autogen.sh生成configure
./autogen.sh
./configure
# -j8 多線程編譯
make -j8
make check
# 安裝編譯成功的protobuf
sudo make install
安裝python模塊
cd python
python setup.py build
python setup.py test
python setup.py install
驗證Python模塊
驗證Python模塊是否被正確安裝
如果沒有報錯,說明安裝正常。
$ python
>>> import google.protobuf.internal
>>> 網(wǎng)頁標題:CentOS6.5下Python版本的ProtoBuf編譯及安裝
文章起源:http://www.fisionsoft.com.cn/article/cojjeio.html


咨詢
建站咨詢
