问题记录:
pip install confluent-kafka报错
command ‘/usr/bin/clang’ failed with exit code 1
详细报错信息如下:
In file included from /private/var/folders/1j/_2k0y4gx0d99ztgscclcdtm00000gn/T/pip-install-pvl5wiht/confluent-kafka_e40a9bb26f4944f4a4cd23aad3a5cb2d/src/confluent_kafka/src/Admin.c:17:
/private/var/folders/1j/_2k0y4gx0d99ztgscclcdtm00000gn/T/pip-install-pvl5wiht/confluent-kafka_e40a9bb26f4944f4a4cd23aad3a5cb2d/src/confluent_kafka/src/confluent_kafka.h:23:10: fatal error: ‘librdkafka/rdkafka.h’ file not found
#include <librdkafka/rdkafka.h>
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command ‘/usr/bin/clang’ failed with exit code 1
解决方法:
1.先在本地安装librdkafka
brew install librdkafka@1.8.2
2.在pip命令前面指定librdkafka头文件的路径,即可顺利安装
C_INCLUDE_PATH=/opt/homebrew/Cellar/librdkafka/1.8.2/include LIBRARY_PATH=/opt/homebrew/Cellar/librdkafka/1.8.2/lib pip install confluent_kafka