1、准备工作
使用python操作kafka目前比较常用的库是kafka-python库,但是在安装这个库的时候需要依赖setuptools库和six库,下面就要分别来下载这几个库
https://pypi.org/project/kafka-python/#files
1.1 下载setuptools
1.2 下载kafka-python
1.3 下载six
下载略
注意版本:
我开始用的setuptools-0.6c11-py2.6.egg + kafka-python-1.4.4.tar.gz + six-1.12.0.tar.gz包,安装后,from kafka import KafkaProducer 是出错,可能原因事版本问题。重新换了一下面的版本,就好了。
2、安装相关python库
在上一步里面我们已经下载了好相关的包,下面开始具体安装,首先创建一个/opt/python_library/,然后把这几个包文件上传到这里
[root@centos03 python_library]# ll
total 600
drwxr-xr-x. 7 5579 5579 4096 Dec 1 21:20 kafka-python-1.3.5
-rw-r--r--. 1 root root 227497 Dec 1 21:18 kafka-python-1.3.5.tar.gz
-rw-r--r--. 1 root root 333447 Dec 1 20:26 setuptools-0.6c11-py2.6.egg
drwxr-xr-x. 6 2000 2000 4096 Dec 1 21:19 six-1.11.0
-rw-r--r--. 1 root root 29860 Dec 1 21:18 six-1.11.0.tar.gz
[root@centos03 python_library]#
2.1 安装setuptools
[root@centos03 python_library]# sh setuptools-0.6c11-py2.6.egg
Processing setuptools-0.6c11-py2.6.egg
Copying setuptools-0.6c11-py2.6.egg to /usr/lib/python2.6/site-packages
Adding setuptools0.6c11 to easy-install.pth file
Installing easy_install script to/usr/bin
Installing easy_install-2.6 script to /usr/bin
Installed/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependenciesfor setuptools==0.6c11
Finished processing dependenciesfor setuptools==0.6c11
[root@centos03 python_library]#
2.2 安装six
[root@centos03 six-1.11.0]# ll
total 140
drwxr-xr-x. 4 root root 4096 Dec 1 21:19 build
-rw-r--r--. 1 2000 2000 7970 Sep 18 2017 CHANGES
drwxr-xr-x. 2 root root 4096 Dec 1 21:19 dist
drwxr-xr-x. 2 2000 2000 4096 Sep 18 2017 documentation
-rw-r--r--. 1 2000 2000 1066 Sep 18 2017 LICENSE
-rw-r--r--. 1 2000 2000 114 Sep 18 2017 MANIFEST.in
-rw-r--r--. 1 2000 2000 1818 Sep 18 2017 PKG-INFO
-rw-r--r--. 1 2000 2000 1096 Sep 18 2017 README.rst
-rw-r--r--. 1 2000 2000 282 Sep 18 2017 setup.cfg
-rw-r--r--. 1 2000 2000 2184 Sep 18 2017 setup.py
drwxr-xr-x. 2 2000 2000 4096 Sep 18 2017 six.egg-info
-rw-r--r--. 1 2000 2000 30888 Sep 18 2017 six.py
-rw-r--r--. 1 root root 30782 Dec 1 21:19 six.pyc
-rw-r--r--. 1 2000 2000 26864 Sep 18 2017 test_six.py
[root@centos03 six-1.11.0]#
执行python setup.py install
[root@centos03 six-1.11.0]# python setup.py install
running install
running bdist_egg
running egg_info
writing six.egg-info/PKG-INFO
writing top-level names to six.egg-info/top_level.txt
writing dependency_links to six.egg-info/dependency_links.txt
writing six.egg-info/PKG-INFO
writing top-level names to six.egg-info/top_level.txt
writing dependency_links to six.egg-info/dependency_links.txt
reading manifest file 'six.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'documentation/_build'
writing manifest file 'six.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
copying build/lib/six.py -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/six.py to six.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying six.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying six.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying six.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying six.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
six: module references __path__
creating 'dist/six-1.11.0-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing six-1.11.0-py2.6.egg
removing '/usr/lib/python2.6/site-packages/six-1.11.0-py2.6.egg' (and everything under it)
creating /usr/lib/python2.6/site-packages/six-1.11.0-py2.6.egg
Extracting six-1.11.0-py2.6.egg to /usr/lib/python2.6/site-packages
six 1.11.0 is already the active version in easy-install.pth
Installed /usr/lib/python2.6/site-packages/six-1.11.0-py2.6.egg
Processing dependencies for six==1.11.0
Finished processing dependencies for six==1.11.0
[root@centos03 six-1.11.0]#
2.3 安装kafka-python
执行tar -zxvf kafka-python-1.3.4.tar.gz解压安装包,会产生kafka-python-1.3.4文件夹,进入到该文件夹
[root@centos03 python_library]# tar -zxvf kafka-python-1.3.5.tar.gz
[root@centos03 kafka-python-1.3.5]# ll
total 100
-rw-r--r--. 1 5579 5579 2508 Jan 24 2016 AUTHORS.md
drwxr-xr-x. 4 root root 4096 Dec 1 21:20 build
-rw-r--r--. 1 5579 5579 33359 Oct 8 2017 CHANGES.md
drwxr-xr-x. 2 root root 4096 Dec 1 21:20 dist
drwxr-xr-x. 10 5579 5579 4096 Dec 1 21:20 kafka
drwxr-xr-x. 2 5579 5579 4096 Oct 8 2017 kafka_python.egg-info
-rw-r--r--. 1 5579 5579 11343 Jan 24 2016 LICENSE
-rw-r--r--. 1 5579 5579 102 Jan 24 2016 MANIFEST.in
-rw-r--r--. 1 5579 5579 8164 Oct 8 2017 PKG-INFO
-rw-r--r--. 1 5579 5579 6056 Oct 8 2017 README.rst
-rw-r--r--. 1 5579 5579 67 Oct 8 2017 setup.cfg
-rw-r--r--. 1 5579 5579 1754 Oct 8 2017 setup.py
drwxr-xr-x. 2 5579 5579 4096 Oct 8 2017 test
[root@centos03 kafka-python-1.3.5]#
执行python setup.py install
[root@centos03 kafka-python-1.3.5]# python setup.py install
running install
running bdist_egg
running egg_info
writing kafka_python.egg-info/PKG-INFO
writing top-level names to kafka_python.egg-info/top_level.txt
writing dependency_links to kafka_python.egg-info/dependency_links.txt
writing kafka_python.egg-info/PKG-INFO
writing top-level names to kafka_python.egg-info/top_level.txt
writing dependency_links to kafka_python.egg-info/dependency_links.txt
reading manifest file 'kafka_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'kafka_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/errors.py -> build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/structs.py -> build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/codec.py -> build/bdist.linux-x86_64/egg/kafka
creating build/bdist.linux-x86_64/egg/kafka/vendor
copying build/lib/kafka/vendor/socketpair.py -> build/bdist.linux-x86_64/egg/kafka/vendor
copying build/lib/kafka/vendor/six.py -> build/bdist.linux-x86_64/egg/kafka/vendor
copying build/lib/kafka/vendor/selectors34.py -> build/bdist.linux-x86_64/egg/kafka/vendor
copying build/lib/kafka/vendor/__init__.py -> build/bdist.linux-x86_64/egg/kafka/vendor
copying build/lib/kafka/future.py -> build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/common.py -> build/bdist.linux-x86_64/egg/kafka
creating build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/future.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/keyed.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/buffer.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/__init__.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/kafka.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/sender.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/record_accumulator.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/simple.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/producer/base.py -> build/bdist.linux-x86_64/egg/kafka/producer
copying build/lib/kafka/version.py -> build/bdist.linux-x86_64/egg/kafka
creating build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/consumer/group.py -> build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/consumer/fetcher.py -> build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/consumer/multiprocess.py -> build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/consumer/subscription_state.py -> build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/consumer/__init__.py -> build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/consumer/simple.py -> build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/consumer/base.py -> build/bdist.linux-x86_64/egg/kafka/consumer
copying build/lib/kafka/client_async.py -> build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/context.py -> build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/cluster.py -> build/bdist.linux-x86_64/egg/kafka
creating build/bdist.linux-x86_64/egg/kafka/partitioner
copying build/lib/kafka/partitioner/default.py -> build/bdist.linux-x86_64/egg/kafka/partitioner
copying build/lib/kafka/partitioner/hashed.py -> build/bdist.linux-x86_64/egg/kafka/partitioner
copying build/lib/kafka/partitioner/__init__.py -> build/bdist.linux-x86_64/egg/kafka/partitioner
copying build/lib/kafka/partitioner/roundrobin.py -> build/bdist.linux-x86_64/egg/kafka/partitioner
copying build/lib/kafka/partitioner/base.py -> build/bdist.linux-x86_64/egg/kafka/partitioner
creating build/bdist.linux-x86_64/egg/kafka/coordinator
copying build/lib/kafka/coordinator/consumer.py -> build/bdist.linux-x86_64/egg/kafka/coordinator
copying build/lib/kafka/coordinator/heartbeat.py -> build/bdist.linux-x86_64/egg/kafka/coordinator
copying build/lib/kafka/coordinator/protocol.py -> build/bdist.linux-x86_64/egg/kafka/coordinator
copying build/lib/kafka/coordinator/__init__.py -> build/bdist.linux-x86_64/egg/kafka/coordinator
copying build/lib/kafka/coordinator/base.py -> build/bdist.linux-x86_64/egg/kafka/coordinator
creating build/bdist.linux-x86_64/egg/kafka/coordinator/assignors
copying build/lib/kafka/coordinator/assignors/range.py -> build/bdist.linux-x86_64/egg/kafka/coordinator/assignors
copying build/lib/kafka/coordinator/assignors/__init__.py -> build/bdist.linux-x86_64/egg/kafka/coordinator/assignors
copying build/lib/kafka/coordinator/assignors/abstract.py -> build/bdist.linux-x86_64/egg/kafka/coordinator/assignors
copying build/lib/kafka/coordinator/assignors/roundrobin.py -> build/bdist.linux-x86_64/egg/kafka/coordinator/assignors
creating build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/kafka_metric.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/metric_name.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/metrics.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/metric_config.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/compound_stat.py -> build/bdist.linux-x86_64/egg/kafka/metrics
creating build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/total.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/max_stat.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/sampled_stat.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/sensor.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/percentiles.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/histogram.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/percentile.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/__init__.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/min_stat.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/avg.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/count.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stats/rate.py -> build/bdist.linux-x86_64/egg/kafka/metrics/stats
copying build/lib/kafka/metrics/stat.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/__init__.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/measurable.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/metrics_reporter.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/measurable_stat.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/quota.py -> build/bdist.linux-x86_64/egg/kafka/metrics
copying build/lib/kafka/metrics/dict_reporter.py -> build/bdist.linux-x86_64/egg/kafka/metrics
creating build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/group.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/api.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/message.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/types.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/produce.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/fetch.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/metadata.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/frame.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/__init__.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/abstract.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/pickle.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/struct.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/commit.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/admin.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/legacy.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/protocol/offset.py -> build/bdist.linux-x86_64/egg/kafka/protocol
copying build/lib/kafka/__init__.py -> build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/client.py -> build/bdist.linux-x86_64/egg/kafka
creating build/bdist.linux-x86_64/egg/kafka/serializer
copying build/lib/kafka/serializer/__init__.py -> build/bdist.linux-x86_64/egg/kafka/serializer
copying build/lib/kafka/serializer/abstract.py -> build/bdist.linux-x86_64/egg/kafka/serializer
copying build/lib/kafka/util.py -> build/bdist.linux-x86_64/egg/kafka
copying build/lib/kafka/conn.py -> build/bdist.linux-x86_64/egg/kafka
byte-compiling build/bdist.linux-x86_64/egg/kafka/errors.py to errors.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/structs.py to structs.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/codec.py to codec.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/vendor/socketpair.py to socketpair.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/vendor/six.py to six.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/vendor/selectors34.py to selectors34.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/vendor/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/future.py to future.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/common.py to common.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/future.py to future.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/keyed.py to keyed.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/buffer.py to buffer.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/kafka.py to kafka.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/sender.py to sender.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/record_accumulator.py to record_accumulator.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/simple.py to simple.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/producer/base.py to base.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/version.py to version.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/consumer/group.py to group.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/consumer/fetcher.py to fetcher.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/consumer/multiprocess.py to multiprocess.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/consumer/subscription_state.py to subscription_state.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/consumer/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/consumer/simple.py to simple.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/consumer/base.py to base.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/client_async.py to client_async.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/context.py to context.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/cluster.py to cluster.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/partitioner/default.py to default.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/partitioner/hashed.py to hashed.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/partitioner/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/partitioner/roundrobin.py to roundrobin.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/partitioner/base.py to base.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/consumer.py to consumer.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/heartbeat.py to heartbeat.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/protocol.py to protocol.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/base.py to base.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/assignors/range.py to range.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/assignors/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/assignors/abstract.py to abstract.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/coordinator/assignors/roundrobin.py to roundrobin.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/kafka_metric.py to kafka_metric.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/metric_name.py to metric_name.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/metrics.py to metrics.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/metric_config.py to metric_config.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/compound_stat.py to compound_stat.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/total.py to total.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/max_stat.py to max_stat.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/sampled_stat.py to sampled_stat.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/sensor.py to sensor.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/percentiles.py to percentiles.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/histogram.py to histogram.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/percentile.py to percentile.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/min_stat.py to min_stat.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/avg.py to avg.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/count.py to count.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stats/rate.py to rate.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/stat.py to stat.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/measurable.py to measurable.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/metrics_reporter.py to metrics_reporter.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/measurable_stat.py to measurable_stat.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/quota.py to quota.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/metrics/dict_reporter.py to dict_reporter.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/group.py to group.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/api.py to api.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/message.py to message.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/types.py to types.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/produce.py to produce.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/fetch.py to fetch.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/metadata.py to metadata.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/frame.py to frame.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/abstract.py to abstract.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/pickle.py to pickle.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/struct.py to struct.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/commit.py to commit.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/admin.py to admin.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/legacy.py to legacy.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/protocol/offset.py to offset.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/client.py to client.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/serializer/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/serializer/abstract.py to abstract.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/util.py to util.pyc
byte-compiling build/bdist.linux-x86_64/egg/kafka/conn.py to conn.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying kafka_python.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kafka_python.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kafka_python.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kafka_python.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
kafka.vendor.six: module references __path__
creating 'dist/kafka_python-1.3.5-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing kafka_python-1.3.5-py2.6.egg
removing '/usr/lib/python2.6/site-packages/kafka_python-1.3.5-py2.6.egg' (and everything under it)
creating /usr/lib/python2.6/site-packages/kafka_python-1.3.5-py2.6.egg
Extracting kafka_python-1.3.5-py2.6.egg to /usr/lib/python2.6/site-packages
kafka-python 1.3.5 is already the active version in easy-install.pth
Installed /usr/lib/python2.6/site-packages/kafka_python-1.3.5-py2.6.egg
Processing dependencies for kafka-python==1.3.5
Finished processing dependencies for kafka-python==1.3.5
[root@centos03 kafka-python-1.3.5]#
3、安装库测试
接下来测试一下,进入python ,导入KafkaProducer,如果没有提示找不到包就证明已经安装OK了
[root@centos03 kafka-python-1.3.5]# python
Python2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type"help", "copyright", "credits" or "license" formore information.>>> from kafka import KafkaProducer
>>>import kafka>>>print(kafka.__version__)1.3.5
>>>