【发布时间】:2018-06-12 07:18:11
【问题描述】:
我正在尝试在 ubuntu 16.04 中使用 cpp 运行一个简单的 thrift 通信。我的 thrift 文件夹位于 usr/local/ 中,而我的 thrift.pc 文件位于 usr/local/lib/pkgconfig.my python 文件夹中 2.7 和3.5 版本位于 usr/local/lib 文件夹中。 我正在关注此站点以创建简单的客户端服务器通信 http://www.avabodh.com/thrift/client_server.html
所以我写了一个简单的calculator.thrift 文件 代码
namspace cpp example
service Calculator
{
i64 add(1:i32 num1, 2:i32 num2);
}
在我的主文件夹中运行
python -m thrift_compiler.main --gen cpp2 calculator.thrift
当我要生成包含所有生成的 cpp 文件的 gen-cpp2 文件夹时出现此错误
/usr/bin/python: No module named thrift_compiler
我的 Thrift 服务器版本是 0.9.3。我对节俭协议很陌生。请帮我弄清楚。谢谢
【问题讨论】:
标签: python-3.x python-2.7 ubuntu-16.04 thrift