1、下载thrift:
代码语言:javascript复制wget http://mirror.bjtu.edu.cn/apache//thrift/0.8.0/thrift-0.8.0.tar.gz
2、安装依赖:
代码语言:javascript复制sudo apt-get install build-essential sudo apt-get install bison flex sudo apt-get install libboost-dev python-dev sudo apt-get install autoconf automake libtool pkg-config sudo apt-get install git
3、安装thrift:
代码语言:javascript复制tar -xzvf thrift-0.8.0.tar.gz cd thrift-0.8.0sudo ./configure --prefix=/host/java/thriftsudo make && sudo make install
4、安装结束:
代码语言:javascript复制In [1]: import thrift --------------------------------------------------------------------------- ImportError Traceback (most recent call last) /host/workspace/QQWeibo/<ipython console> in <module>() ImportError: No module named thrift
查看thrift模块是否处于sys.path中
代码语言:javascript复制In [7]: sys.path.append('/usr/lib/python2.7/site-packages') In [8]: import thrift
加入之后ok
代码语言:javascript复制在.bashrc文件中加入: export PYTHONPATH=/usr/lib/python2.7/site-packages