【环境安装】python操作zookeeper.md
- 环境
名称 版本
centos 7
python 2.7.5
zookeeper 3.4.10 - 安装步骤
首先,安装要依赖的zookeeper的c的客户端。
cd path/zookeeper/src/c
./configure
如果有以下报错信息:
(py2) [root@master c]# ./configure
checking for doxygen… no
checking for perl… /usr/bin/perl
checking for dot… no
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking for cppunit-config… no
checking for Cppunit - version >= 1.10.2… no
checking for generated/zookeeper.jute.c… yes
checking for generated/zookeeper.jute.h… yes
checking for gcc… no
checking for cc… no
checking for cc… no
checking for cl… no
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details.
执行以下命令:
yum -y install gcc*
./configure
make
make install
安装zkpython,通过pip和源码方式安装
pip安装:
pip install zkpython
源码安装: 首先进入到:https://pypi.org/search/?q=zkpython 下载源码
解压之后进入目录执行以下命令
python steup.py install
添加环境变量:
export LD_LIBRARY_PATH=/usr/local/lib
如果不添加环境变量,在import zookeeper包的时候会报错:
import zookeeper
Traceback (most recent call last):
File “”, line 1, in
ImportError: libzookeeper_mt.so.2: cannot open shared object file: No such file or directory
参考资料
https://www.jianshu.com/p/11199dd5487e
https://www.cnblogs.com/fusx/p/10599448.html
https://www.cnblogs.com/mangoVic/p/6428369.html
https://blog.youkuaiyun.com/qq_34485930/article/details/80934025
https://blog.youkuaiyun.com/hongweigg/article/details/72957213