1. 环境
名称 | 版本 |
---|---|
centos | 7.5 |
python | 2.7.5 |
zookeeper | 3.4.10 |
2. 安装步骤
- 首先,安装要依赖的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和源码方式安装(如果安装zkpython报错查看参考资料提供的链接)
- pip安装:
pip install zkpython
- 源码安装: 首先进入到:https://pypi.org/search/?q=zkpython 下载源码
解压之后进入目录执行以下命令 python steup.py install
- pip安装:
- 添加环境变量:
export LD_LIBRARY_PATH=/usr/local/lib
如果不添加环境变量,在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
参考资料
Centos7安装zkpython报错:Python.h 没有那个文件或目录
文章评论