google protobuf编译安装(ImportError: No module named google.protobuf.internal)

google protobuf编译安装(ImportError: No module named google.protobuf.internal)


最近在编译caffe python接口,python下import caffe报这个错误

ImportError: No module named google.protobuf.internal

原因是之前一步 pip install -r requirement.txt不成功,原因是数据源拉不到东西,只得自己亲手安装了。

首先现在protobuf 

   下载protobuf-2.3.0:  

        http://protobuf.googlecode.com/files/protobuf-2.3.0.zip

       上边这个地址是在别的博客找到的,caffe要求这个版本要>=2.5.0,自己手动把地址里边的版本改为2.5.0成功下载。


接下来就是安装了:


unzip protobuf-2.5.0

cd protobuf-2.5.0

chmod 777 configure

./configure

make -j4

make check -j4

make install 


make install 完貌似有报错,我主要用python接口这个就没管


接下来编译python接口的(不需要python接口的请跳过)

cd ./python 
python setup.py build 
python setup.py test 
python setup.py install


验证使用命令 protoc -version
这步我还没有得到结果。

可是在python 下使用 
>>import google.protobuf
没有报错,那就是能用了。

那些错误我估计是环境变量什么的问题,先不去找这个原因了。

猜你喜欢

转载自blog.csdn.net/cvaidl/article/details/79470517