1.安装相关的依赖包
sudo apt-get install automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config
2.解压压缩文件
tar -zxvf thrift-0.9.3.tar.gz
3.进入Thrift安装主目录
cd thrift-0.9.3
4 ./configure (可能出现权限不够,请修改文件权限sudo chmod 777 configure)
./configure --with-cpp --with-boost --without-python --without-csharp --with-java --without-erlang --without-perl --with-php --without-php_extension --without-ruby --without-haskell --without-go
如果有很多error就是用下面的代码:
或者:
sudo ./configure --with-boost=/usr/local
这里可能报错:
g++: error: /usr/local/lib/libboost_unit_test_framework.a: No such file or directory
解决方案:
find / -name libboost_unit_test_framework.*
cp /usr/local/lib/libboost_unit_test_framework.a /usr/local/lib
5.sudo make
6.sudo make install
验证thrift是否装好
thrift -version
结合Python
首先是thrift的python程序库的安装,有些基础库需要安装后才能运行,在thrift的目录库目录中,选择py目录,使用root账户就可以直接安装了。
cd thrift-0.9.0/lib/py
python setup.py install