我正在尝试使用pip安装python confluent-kafka包。我在一个运行amazon linux (版本Amazon Linux AMI release 2016.09)的aws ec2实例上尝试这样做。我只是在做:
pip install pip install confluent-kafka但是,这会产生以下错误:
In file included from confluent_kafka/src/confluent_kafka.c:17:0:
confluent_kafka/src/confluent_kafka.h:21:32: fatal error: librdkafka/rdkafka.h: No such file or directory
#include <librdkafka/rdkafka.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1为了解决这个问题,我做了两件事:
1)按照this page上的说明,添加了包含内容的/etc/yum.repos.d/confluent.repo文件:
[Confluent.dist]
name=Confluent repository (dist)
baseurl=http://packages.confluent.io/rpm/3.0/6
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.0/archive.key
enabled=1
[Confluent]
name=Confluent repository
baseurl=http://packages.confluent.io/rpm/3.0
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.0/archive.key
enabled=12)尝试使用以下命令安装librdkafka库:
sudo yum clean all
sudo yum install -y librdkafka1 librdkafka-devel然而,Yum给出了这个错误:
Error: Package: librdkafka1-0.9.1_confluent3.0.1-1.el7.x86_64 (Confluent.dist)
Requires: openssl-libs
Error: Package: librdkafka1-0.9.1_confluent3.0.1-1.el7.x86_64 (Confluent.dist)
Requires: libsasl2.so.3()(64bit)在some googling之后,我尝试了:
sudo ln /usr/lib64/libsasl2.so.2 /usr/lib64/libsasl2.so.3这没有效果。我试图做一个yum升级,但这也不能解决问题。经过大量的谷歌搜索,this kafka user group post是我能找到的唯一有一点帮助的东西,但遗憾的是,它并没有包含问题的解决方案。
我真的很想让kafka python在这个实例上运行,所以任何建议都会非常感谢。
发布于 2017-01-20 05:37:55
Amazon Linux 2016.19似乎是基于RHEL6的,因此您需要像Confluent docs中描述的那样引用Confluent的RHEL6YUM代码库,即通过向/etc/yum.repos.d/confluent编写以下代码
[Confluent.dist]
name=Confluent repository (dist)
baseurl=http://packages.confluent.io/rpm/3.1/6
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.1/archive.key
enabled=1
[Confluent]
name=Confluent repository
baseurl=http://packages.confluent.io/rpm/3.1
gpgcheck=1
gpgkey=http://packages.confluent.io/rpm/3.1/archive.key
enabled=1然后是:
$ sudo yum clean all
$ sudo yum install gcc librdkafka1 librdkafka-devel cyrus-sasl-devel openssl-libs python-devel
$ pip install confluent-kafka (possibly in a virtualenv)https://stackoverflow.com/questions/41731752
复制相似问题