错误安装Confluent Kafka -LD:未找到-lrdkafka的库

发布于 2025-02-13 11:08:47 字数 3848 浏览 1 评论 0 原文

我正在尝试在Mac OS上安装Confluent Kafka Python模块。 我的python版本是3.9 我一直在低于错误。

有人知道如何解决这个问题吗?

      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c /private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.c -o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.o
      /private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.c:2545:9: warning: 'PyEval_InitThreads' is deprecated [-Wdeprecated-declarations]
              PyEval_InitThreads();
              ^
      /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9/ceval.h:130:1: note: 'PyEval_InitThreads' has been explicitly marked deprecated here
      Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
      ^
      /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      1 warning generated.
      clang -bundle -undefined dynamic_lookup build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Admin.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/AdminTypes.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Consumer.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Metadata.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Producer.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.o -lrdkafka -o build/lib.macosx-12-arm64-cpython-39/confluent_kafka/cimpl.cpython-39-darwin.so
      ld: library not found for -lrdkafka
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> confluent-kafka

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: There was an error checking the latest version of pip.

I am trying to install confluent kafka python module on my mac os.
My python version is 3.9
I am keep getting below error.

Does anyone know how to fix this?

      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c /private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.c -o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.o
      /private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.c:2545:9: warning: 'PyEval_InitThreads' is deprecated [-Wdeprecated-declarations]
              PyEval_InitThreads();
              ^
      /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9/ceval.h:130:1: note: 'PyEval_InitThreads' has been explicitly marked deprecated here
      Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
      ^
      /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      1 warning generated.
      clang -bundle -undefined dynamic_lookup build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Admin.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/AdminTypes.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Consumer.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Metadata.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/Producer.o build/temp.macosx-12-arm64-cpython-39/private/var/folders/tm/l00fw55n55vgglqsy56lhgbh0000gn/T/pip-install-eocpb3xa/confluent-kafka_f77dbcfd032f447791927683e1f5f56b/src/confluent_kafka/src/confluent_kafka.o -lrdkafka -o build/lib.macosx-12-arm64-cpython-39/confluent_kafka/cimpl.cpython-39-darwin.so
      ld: library not found for -lrdkafka
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> confluent-kafka

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
WARNING: There was an error checking the latest version of pip.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒人说梦 2025-02-20 11:08:47

您似乎正在使用M1 Mac。

这是Aarch64/ARM64库的一个空缺问题,

同时,您也许可以使用 kafka-python aiokafka ,因为它们不依赖于 librdkafka

You appear to be using an M1 Mac.

This is an open issue for aarch64 / arm64 libraries https://github.com/confluentinc/confluent-kafka-python/issues/1190

In the meantime, you might be able to use kafka-python or aiokafka since they don't depend on librdkafka.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文