$ sudo apt-get install autoconf automake libtool curl make g++ unzip
到GitHub下载https://github.com/google/protobuf/releases/下载.或用这地址下载v3.3的 https://github.com/google/protobuf/archive/v3.3.0.zip
``` shell cd protobuf-3.3.0/ $ ./autogen.sh $ ./configure $ make $ make check
```shell ============================================================================ Testsuite summary for Protocol Buffers 3.3.0 ============================================================================ # TOTAL: 7 # PASS: 7 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================
$ sudo make install $ sudo ldconfig # refresh shared library cache.
测试是否安装成功.
protoc --version
正常应该是输出
libprotoc 3.3.0
如果报错提示:
protoc: error while loading shared libraries: libprotoc.so.13: cannot open shared object file: No such file or directory
错误原因
protobuf的默认安装路径是/usr/local/lib,而/usr/local/lib不在ubuntu体系默认的LDLIBRARYPATH里,所以就找不到lib
解决办法
1 在/etc/ld.so.conf.d/
目录下创建文件 bprotobuf.conf文件,文件内容如下
/usr/local/lib
2 输入命令
sudo ldconfig
这时,再输入protoc --version
就可以正常看到版本号了
继续安装protobuf的Python模块
$cd ./python $python setup.py build $python setup.py test $python setup.py install
Installed /usr/local/lib/python2.7/dist-packages/protobuf-3.3.0-py2.7.egg Processing dependencies for protobuf==3.3.0 Searching for setuptools==26.1.1 Best match: setuptools 26.1.1 Adding setuptools 26.1.1 to easy-install.pth file Installing easy_install-3.5 script to /usr/local/bin Installing easy_install script to /usr/local/bin Using /usr/local/lib/python2.7/dist-packages Searching for six==1.10.0 Best match: six 1.10.0 Adding six 1.10.0 to easy-install.pth file Using /usr/local/lib/python2.7/dist-packages Finished processing dependencies for protobuf==3.3.0
测试是否安装好
sudo python -c 'import google.protobuf;print google.protobuf.__version__'
如果正常,输出3.3.0
版本号.
stat -c "%a %n" file , 755, 644
ModuleNotFoundError: No module named 'MySQLdb', ...
Ubuntu18.04下使用pyenv安装python报错:BUILD FAILED (Ubun ...
dell提供了工具远程查看服务器硬件状态,可以修改硬件的参数,可以远程连接过去直接修改,就不需要 ...
启动报undefined symbol: EVP_CIPHER_CTX_cleanup错误。op ...
ubuntu开启crontab日志记录及解决No MTA installed, discardi ...
暂时还没有评论,第一个来评论吧!