因为要学习faster r-cnn,在搭建环境的时,发现原本通过yum安装的protobuf没有安装Python版本以及其他一系列版本版本兼容性问题,导致我必须用编译方式重新安装protobuf2.5
下载源码
首先,从github上下载protobuf的源码,地址:https://github.com/google/protobuf,我选择下载2.5.0版本。
编译protobuf
然后将下载的压缩包解压缩
unzip protobuf-2.5.0.zipautogen.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; thenecho"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
figoogletest1.5.0可以到主机宝贝资源站下载:
具体下载目录在 /2017年资料/3月/27日/CentOS6.5下Python版本的ProtoBuf编译及安装/
#解压缩
unzip gtest-1.5.0.zip
mv gtest-1.5.0 gtest执行protobuf编译
#执行autogen.sh生成configure
./autogen.sh
./configure
# -j8 多线程编译
make -j8
make check
# 安装编译成功的protobufsudo make install安装python模块
cd python
python setup.py build
python setup.py test
python setup.py install验证Python模块
验证Python模块是否被正确安装
如果没有报错,说明安装正常。
$ python
>>> import google.protobuf.internal
>>> 文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/222990.html<

