我如何在python中导入hbase? [英] How can I import hbase in python?

查看:463
本文介绍了我如何在python中导入hbase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在python中使用hbase,并且我正在使用cloudera存储库来安装hadoop / hbase软件包。它似乎工作,因为我可以使用shell访问和使用数据库的工作,但它不完全在python中工作。



我知道与hbase沟通我需要节俭,所以我从源代码下载和编译,我可以导入thrift到python,但是当我从hbase导入Hbase 执行时,我得到模块未找到错误。

有人知道我需要什么软件包/模块才能使它工作吗?我试图环顾easy_install和yum(我使用的是centos6),但没有运气。我找到了一篇文章,其中使用debain的人通过安装 sudo aptiutde install python-hbase 来安装它,我没有那个命令/包,所以我不知道如何(或者如果我必须从源代码编译得到它)。

另外,如果它有帮助,我从cloudera安装了大部分基础,并遵循一些指令(那些不需要安装)从 http ://yannramin.com/2008/07/19/using-facebook-thrift-with-python-and-hbase/



任何帮助/提示/ b
$ b

谢谢!

解决方案

好的,我想到了。如果其他人在将来遇到这个问题,其实很简单。在运行 thrift --gen py Hbase.thrift 的步骤中,它会在您运行该命令的位置创建一个hbase文件夹。只需执行该命令并将其复制到默认的模块文件夹(或者在您运行程序的文件夹中,它应该可以工作)。


I'm trying to play around with hbase in python and I am using the cloudera repository to install the hadoop/hbase packages. It seems to work as I can access and work on the database using the shell but its not fully working within python.

I know to communicate with hbase I need thrift so I downloaded and complied it from source, I can import thrift into python but when I do from hbase import Hbase, I get module not found errors.

Does anyone know what package/module I would need to get it to work? I tried to look around easy_install and yum(I'm using centos6) and no luck. I did find an article where a person using debain installed it by doing sudo aptiutde install python-hbase I don't have that command/package, so I'm not sure how to get it(or if I have to compile from source to get it).

Also if it helps, I installed most of the base from cloudera and followed some instructions(the ones didn't require install) from http://yannramin.com/2008/07/19/using-facebook-thrift-with-python-and-hbase/

Any help/tips/suggestions would be great.

Thanks!

解决方案

Okay, I figured it out. If anyone else is having problems with this in the future its actually pretty easy. In the step where you run thrift --gen py Hbase.thrift, it creates a hbase folder in the location you ran that command. Simply take that command and copy it to your default module folder(or in the folder where you run your program and it should work).

这篇关于我如何在python中导入hbase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆