zkpython安装

  1. 下载zookeeper,去官网下载zookeeper-3.4.9.tar.gz
  2. 安装源码(需要装源码,因为zkpython装的时候有头文件引用)
tar xf zookeeper-3.4.9.tar.gz
cd zookeeper-3.4.9/src/c
./configure
make
make install

这样之后,在/usr/local/include/zookeeper下会安装好zookeeper的源码
3. 安装zkpython
去python包网站https://pypi.Python.org下载zkpython-0.4.tar.gz

tar xf zkpython-0.4.tar.gz
cd zkpython-0.4

在安装前,需要修改安装依赖的位置,修改setup.py文件:
在文件中增加zookeeper源码安装到的位置/usr/local/include/zookeeper

include_dirs=["/usr/include/c-client-src", "/usr/local/include/c-client-src", "/usr/local/include/zookeeper"],

执行安装:

python setup.py install

4. 更新python库环境变量
/usr/local/lib/发现安装好的库,如下:

[root@lin zkpython-0.4]# ll /usr/local/lib/
total 2556
-rw-r--r--. 1 root root 881364 Dec 22 00:20 libzookeeper_mt.a
-rwxr-xr-x. 1 root root   1011 Dec 22 00:20 libzookeeper_mt.la
lrwxrwxrwx. 1 root root     24 Dec 22 00:20 libzookeeper_mt.so -> libzookeeper_mt.so.2.0.0
lrwxrwxrwx. 1 root root     24 Dec 22 00:20 libzookeeper_mt.so.2 -> libzookeeper_mt.so.2.0.0
-rwxr-xr-x. 1 root root 453559 Dec 22 00:20 libzookeeper_mt.so.2.0.0
-rw-r--r--. 1 root root 833886 Dec 22 00:20 libzookeeper_st.a
-rwxr-xr-x. 1 root root   1001 Dec 22 00:20 libzookeeper_st.la
lrwxrwxrwx. 1 root root     24 Dec 22 00:20 libzookeeper_st.so -> libzookeeper_st.so.2.0.0
lrwxrwxrwx. 1 root root     24 Dec 22 00:20 libzookeeper_st.so.2 -> libzookeeper_st.so.2.0.0
-rwxr-xr-x. 1 root root 433484 Dec 22 00:20 libzookeeper_st.so.2.0.0

更新用户环境变量:

vi ~/.bashrc
增加:
export LD_LIBRARY_PATH=/usr/local/lib/
然后重新加载环境变量
source ~/.bashrc

5. 测试

[root@lin zkpython-0.4]# python
Python 2.7.5 (default, Nov 20 2015, 02:00:19) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import zookeeper
>>> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值