【发布时间】:2014-11-11 15:04:50
【问题描述】:
我已经使用 Homebrew 在我的 Mac 上安装了 Thrift:brew install thrift --with-python
这做了一些工作并完成了,没有报告错误。我的道路上有节俭。
我根据教程编写了一个简单的python客户端:(gen-py中有一些python节俭代码)
#!/usr/bin/python
import sys
sys.path.append("./gen-py")
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
# rest of program...
运行时出现此错误:
Traceback (most recent call last):
File "./hey.py", line 8, in <module>
from thrift import Thrift
ImportError: No module named thrift
我是否使用 Homebrew 正确安装了 python?有没有办法验证 python/thrift 集成是否正确安装?
【问题讨论】:
-
我不是 python 人,但您是否也包含了 Thrift 库代码?分两部分,
gen-py中生成的代码和库代码。