I thought that Thrift doesn't support python3, so I looked it up.
https://issues.apache.org/jira/browse/THRIFT-1857 That? Issue is fixed and closed, but this is ...
If you take a closer look, it is supported by ver 0.10.0, but since the latest version is currently 0.9.3 (as of November 23, 2016), it cannot be compiled into python3. It seems that you have to check out the latest version ...
git clone https://github.com/apache/thrift.git
git branch -a // Check for existing branch git checkout -b 0.10.0 remotes/origin/0.10.0
All the "Requirements for building from source" here http://thrift.apache.org/docs/install/
sudo apt-get update
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libboost-filesystem-dev libboost-thread-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
https://github.com/apache/thrift/tree/0.10.0
./bootstrap.sh
./configure
sudo make
sudo make install
thrift -version
If "Thrift version 0.10.0" is printed, the installation is successful.
thrift -r --gen py test.thrift
The "py-gen" directory has been successfully created! You can also import from python3.5.
I mean ... I felt that the road to python3 was still a long way off.
It seems that even if you use something called thriftpy, it can support python 3 series. https://github.com/eleme/thriftpy
I don't know when the release version of 0.10.0 will come out, but if the only purpose is to compile to python3 I personally think that I don't have to use it.
Recommended Posts