Install and configure Apache Thrift

Source: Internet
Author: User

thrift is a software library developed by Facebook and a set of Code generation tools, to accelerate the development and implementation of efficient and scalable backend services. It abstracts the most commonly used parts of each language, puts them into a universal library, and implements them using each language, to achieve efficient and reliable communication across programming languages . That is, thrift allows developers to define data types and service interfaces in a separate language-independent file, and then generate all the code required to build RPC clients and servers. Download the latest installation package from the official website (http://thrift.apache.org/download/)

Cd ~WgetHTTP://Www.us.apache.org/dist/thrift/0.8.0/thrift-0.8.0.tar.gzTar-Zxvf thrift-0.8.0.Tar. Gzcd Thrift-0.8.0./ConfigureMakeSudo Make Install

-- Prefix specifies the installation directory
In README, execute./Bootstrap. Sh before installing (some blogs), because you cannot find this script.

By default, it installs generators in multiple target languages. If your machine happens to lack a library that depends on a language, the installation may fail. For example, I only need to install the generators in Java, C ++, Python, and these three languages, when you execute configure, you must disable other languages; otherwise, the system will fail.

./Configure -- without-CSHARP -- without-Erlang -- without-perl -- without-PHP -- without-php_extension -- without-Haskell -- without-Ruby

 

Python and thrift:

 
Python>>>From Thrift. Transport Import ttransporttraceback (most recent callLast): From Thrift. Transport Import ttransportimporterror: No module named thrift. Transport

In the network, thrift has been installed successfully. python is installed in/usr/lib/python2.7/Site-packages/thrift, based on Windows usage experience, we need to put this directory in the PATH environment variable. In the Ubuntu GUI environment, each time a shell window (base shell) is opened) it always reads a file named bash. bashrc File

 
CD/Etcvi Bash. bashrc

Add a line of code at the end of the file

Export pythonpath =/usr/lib/python2.7/Site-packages

 

Then you can import thrift in the Python script.

From Thrift import Thrift

The configuration has been successful.

 

References

Official Website

Http://thrift.apache.org/

How to use Evernote

Http://www.openapis.net/Help.EVERNOTEbaseThriftdzopenAPI.ashx

InstallArticle(Tell me to remove without language)

Http://blog.csdn.net/hbuxiaoshe/article/details/6557670

Tell me how to configure Environment Variables

Http://blog.sina.com.cn/s/blog_538772e90100wazs.html

Detailed environment variable configuration article

Http://blog.csdn.net/ylgrgyq/article/details/6955591

Solve errors in source code

Http://abloz.com/2012/05/31/thrift-typeerror-getaddrinfo-argument-1-must-be-the-string-or-none.html/comment-page-1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.