Python ZKPython 安装

1.由于python客户端依赖c的客户端所以要先安装c版本的客户端
cd zookeeper-3.4.5/src/c
./configure
make 
make install

2.下载python扩展包,并且解压:
地址:https://pypi.python.org/pypi/zkpython/0.4.2

3.如果找不到Pyhon.h,可能由于没有安装python26-devel
32位直接运行
yum install python26-devel.i386
python setup.py install


4.测试是否成功
import zookeeper  

如果报错:
>>> import zookeeper
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: libzookeeper_mt.so.2: cannot open shared object file: No such file or directory
在shell中配置或者假如/etc/profile文件中:
export LD_LIBRARY_PATH=/usr/local/lib/

5.使用
>>> import zookeeper
>>> hander = zookeeper.init("dc002.tj:2181")
>>> dir(zookeeper) #方法列表

posted @ 2017-11-07 16:30  扫地猿  阅读(1365)  评论(0编辑  收藏  举报