Linux ZKPython 安装

文章来源:http://blog.csdn.net/u010183402/article/details/72998411

需求:
在 centos 系统中使用Python2.7操控ZooKeeper

pip install zkpython

报异常:

 error: command 'gcc' failed with exit status 1

原因:
zookeeper python客户端依赖c客户端,所以要先安装c版本客户端
操作:

1、安装 zookeeper c 客户端

> wget -c http://apache.fayea.com/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
> tar -zxvf zookeeper-3.4.10.tar.gz
> cd zookeeper-3.3.6/src/c
> ./configure
> make
> make install

2、测试 c 客户端

> cli_mt localhost:2181
Watcher -1 state = CONNECTED_STATE
Got a new session id: 0x153efa28d380346
> ls /
time = 0 msec
/: rc = 0
    otter
    zookeeper
time = 0 msec

3、安装 zkpython

pip install zkpython

4、测试zkpython

> python2.7
>>> import zookeeper
>>> hander = zookeeper.init("localhost:2181")
>>> zookeeper.get_children(hander, "/")
['otter', 'zookeeper']

5、其他 API 自行查文档

> pydoc zookeeper

完成~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值