情况
我们在启动hbase的thrift服务后使用python来进行测试连接hbase时报错ImportError: No module named thrift。
完整报错如下:
[root@host252 thrift]# python test.py
Traceback (most recent call last):
File "test.py", line 3, in
from thrift import Thrift
ImportError: No module named thrift
test.py的内容为:
import sys
sys.path.append('/usr/local/python27/lib/python2.7/site-packages/happyhbase')
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
from hbase.ttypes import *
transport = TSocket.TSocket('192.168.30.251', 9090)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = Hbase.Client(protoc