問(wèn)題
python 缺失protobuf包
ImportError: No module named google.protobuf.internal
解決辦法
- 安裝
傳送門 自己下載所需對(duì)應(yīng)版本
#下載
[root@centos6 develop]# wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz
#解壓
[root@centos6 develop]# tar zxf protobuf-all-3.6.1.tar.gz
#到解壓目錄
[root@centos6 develop]# cd protobuf-3.6.1/
# 編譯 安裝
[root@centos6 protobuf-3.6.1]# ./configure
[root@centos6 protobuf-3.6.1]# make
[root@centos6 protobuf-3.6.1]# make install
# 安裝protobuf的python模塊
[root@centos6 protobuf-3.6.1]# cd python/
[root@centos6 python]# python setup.py build
[root@centos6 python]# python setup.py install
ps:如果沒(méi)有遇到編譯上的問(wèn)題,那么恭喜你了。我就遇到了下述超級(jí)多問(wèn)題
問(wèn)題
- 問(wèn)題1
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/develop/protobuf-3.6.1':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
#問(wèn)題的根源是缺少必要的C++庫(kù),執(zhí)行下述命令安裝對(duì)應(yīng)的庫(kù)
[root@centos6 protobuf-3.6.1]# yum install glibc-headers
[root@centos6 protobuf-3.6.1]# yum install gcc-c++
- 問(wèn)題2
# ./configure 出現(xiàn)問(wèn)題
configure: error: in `/develop/protobuf-3.6.1':
configure: error: sched_yield was not found on your system
#查看對(duì)應(yīng)的config.log 原因就是你系統(tǒng)的gcc版本過(guò)低,不支持c++11 ,需要4.7.1以上
configure:7553: result: use default: -O2 -g -std=c++11 -DNDEBUG
configure:7573: checking whether __SUNPRO_CC is declared
configure:7573: g++ -c -g -std=c++11 -DNDEBUG conftest.cpp >&5
cc1plus: error: unrecognized command line option "-std=c++11"
請(qǐng)移步升級(jí)GCC文章centos 6.5 手動(dòng)升級(jí)gcc