1、需求:
需要使用Python编写kafka组件的测试代码
2、问题:目前需要kafka-python的模块,在Linux的服务器上查找发现pip命令不存在,所以下该包在本地电脑上下载下来,然后上传到服务器上进行安装,步骤是:
下载地址:https://pypi.org/project/kafka-python/#modal-close
tar xvf kafka-python-2.0.1.tar.gz
cd kafka-python-2.0.1
python setup.py install
[root@84c96165-ed8b-478a-820b-e688a6057622 kafka-python-2.0.1]# 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.
>>> from kafka import KafkaProducer
>>>
发现可以导入包了
python默认的镜像源为:https://pypi.python.org/simple/kafka/
清华: https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣: http://pypi.douban.com/simple/
阿里: http://mirrors.aliyun.com/pypi/simple/
pip2 install kafka-python -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
网友评论