Mac OS 安装 rocketmq-client-python【ImportError: rocketmq dynamic library not found】

问题

执行pip install rocketmq-client-python

之后调用的时候报错:

File "/home/ops/python3/lib/python3.7/site-packages/rocketmq/ffi.py", line 40, in <module>

raise ImportError('rocketmq dynamic library not found')

ImportError: rocketmq dynamic library not found

原因

查了一堆问题后,发现需要先安装rocketmq的cpp包。

步骤1

参照github地址:

GitHub - apache/rocketmq-client-python: Apache RocketMQ python client​​​​​

中prerequisites的步骤,

步骤2

这里需要注意,mac上未安装wget的话需要先安装wget。

直接键入:brew install wget

步骤3

如果brew未安装的话,参照如下安装教程:MAC 安装brew[更新日期 20220428]_Labiod的博客-优快云博客 

 步骤4

wget安装好后:

执行如下指令:参考自上述GitHub。

    wget https://github.com/apache/rocketmq-client-cpp/releases/download/2.0.0/rocketmq-client-cpp-2.0.0-bin-release.darwin.tar.gz
    tar -xzf rocketmq-client-cpp-2.0.0-bin-release.darwin.tar.gz
    cd rocketmq-client-cpp
    mkdir /usr/local/include/rocketmq
    cp include/* /usr/local/include/rocketmq
    cp lib/* /usr/local/lib
    install_name_tool -id "@rpath/librocketmq.dylib" /usr/local/lib/librocketmq.dylib

步骤5

如果步骤4中: mkdir /usr/local/include/rocketmq 报找不到路径和权限问题的错误。

就将提替换成:

sudo mkdir /usr/local/include

sudo mkdir /usr/local/include/rocketmq

如果步骤4中

    cp include/* /usr/local/include/rocketmq
    cp lib/* /usr/local/lib
    install_name_tool -id "@rpath/librocketmq.dylib" /usr/local/lib/librocketmq.dylib

爆权限问题,就将其替换成:

    sudo cp include/* /usr/local/include/rocketmq
    sudo cp lib/* /usr/local/lib
    sudo install_name_tool -id "@rpath/librocketmq.dylib" /usr/local/lib/librocketmq.dylib

步骤6

待上述操作完成后,执行如下命令:

pip uninstall rocketmq-client-python

pip install rocketmq-client-python

完成

如上述步骤即可。

(.goog) PS E:\tensflowcode\GoogLeNet-Inception-master> & E:/tensflowcode/GoogLeNet-Inception-master/.goog/Scripts/python.exe e:/tensflowcode/GoogLeNet-Inception-master/GoogLeNet-Inception-master/examples/inception_pretrained.py 2025-07-29 16:16:27.967103: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2025-07-29 16:16:27.967322: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "e:\tensflowcode\GoogLeNet-Inception-master\GoogLeNet-Inception-master\examples\inception_pretrained.py", line 11, in <module> import tensorflow as tf File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\__init__.py", line 37, in <module> from tensorflow.python.eager import context File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module> from tensorflow.python.client import pywrap_tf_session File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\client\pywrap_tf_session.py", line 19, in <module> from tensorflow.python.client._pywrap_tf_session import * AttributeError: _ARRAY_API not found A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "e:\tensflowcode\GoogLeNet-Inception-master\GoogLeNet-Inception-master\examples\inception_pretrained.py", line 11, in <module> import tensorflow as tf File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\__init__.py", line 42, in <module> from tensorflow.python import data File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\__init__.py", line 21, in <module> from tensorflow.python.data import experimental File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\__init__.py", line 95, in <module> from tensorflow.python.data.experimental import service File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\service\__init__.py", line 387, in <module> from tensorflow.python.data.experimental.ops.data_service_ops import distribute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\ops\data_service_ops.py", line 22, in <module> from tensorflow.python.data.experimental.ops import compression_ops File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\ops\compression_ops.py", line 16, in <module> from tensorflow.python.data.util import structure File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\structure.py", line 22, in <module> from tensorflow.python.data.util import nest File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\nest.py", line 36, in <module> from tensorflow.python.framework import sparse_tensor as _sparse_tensor File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\sparse_tensor.py", line 24, in <module> from tensorflow.python.framework import constant_op File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\constant_op.py", line 25, in <module> from tensorflow.python.eager import execute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\eager\execute.py", line 23, in <module> from tensorflow.python.framework import dtypes File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\dtypes.py", line 26, in <module> from tensorflow.python.lib.core import _pywrap_bfloat16 AttributeError: _ARRAY_API not found ImportError: numpy.core._multiarray_umath failed to import ImportError: numpy.core.umath failed to import Traceback (most recent call last): File "e:\tensflowcode\GoogLeNet-Inception-master\GoogLeNet-Inception-master\examples\inception_pretrained.py", line 11, in <module> import tensorflow as tf File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\__init__.py", line 42, in <module> from tensorflow.python import data File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\__init__.py", line 21, in <module> from tensorflow.python.data import experimental File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\__init__.py", line 95, in <module> from tensorflow.python.data.experimental import service File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\service\__init__.py", line 387, in <module> from tensorflow.python.data.experimental.ops.data_service_ops import distribute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\ops\data_service_ops.py", line 22, in <module> from tensorflow.python.data.experimental.ops import compression_ops File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\structure.py", line 22, in <module> from tensorflow.python.data.util import nest File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\nest.py", line 36, in <module> from tensorflow.python.framework import sparse_tensor as _sparse_tensor File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\sparse_tensor.py", line 24, in <module> from tensorflow.python.framework import constant_op File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\constant_op.py", line 25, in <module> from tensorflow.python.eager import execute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\eager\execute.py", line 23, in <module> from tensorflow.python.framework import dtypes File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\dtypes.py", line 29, in <module> _np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle (.goog) PS E:\tensflowcode\GoogLeNet-Inception-master> & E:/tensflowcode/GoogLeNet-Inception-master/.goog/Scripts/python.exe e:/tensflowcode/GoogLeNet-Inception-master/GoogLeNet-Inception-master/examples/inception_pretrained.py 2025-07-29 16:17:24.586494: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2025-07-29 16:17:24.586663: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "e:\tensflowcode\GoogLeNet-Inception-master\GoogLeNet-Inception-master\examples\inception_pretrained.py", line 11, in <module> import tensorflow as tf File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\__init__.py", line 37, in <module> from tensorflow.python.eager import context File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module> from tensorflow.python.client import pywrap_tf_session File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\client\pywrap_tf_session.py", line 19, in <module> from tensorflow.python.client._pywrap_tf_session import * AttributeError: _ARRAY_API not found A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "e:\tensflowcode\GoogLeNet-Inception-master\GoogLeNet-Inception-master\examples\inception_pretrained.py", line 11, in <module> import tensorflow as tf File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\__init__.py", line 42, in <module> from tensorflow.python import data File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\__init__.py", line 21, in <module> from tensorflow.python.data import experimental File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\__init__.py", line 95, in <module> from tensorflow.python.data.experimental import service File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\service\__init__.py", line 387, in <module> from tensorflow.python.data.experimental.ops.data_service_ops import distribute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\ops\data_service_ops.py", line 22, in <module> from tensorflow.python.data.experimental.ops import compression_ops File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\ops\compression_ops.py", line 16, in <module> from tensorflow.python.data.util import structure File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\structure.py", line 22, in <module> from tensorflow.python.data.util import nest File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\nest.py", line 36, in <module> from tensorflow.python.framework import sparse_tensor as _sparse_tensor File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\sparse_tensor.py", line 24, in <module> from tensorflow.python.framework import constant_op File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\constant_op.py", line 25, in <module> from tensorflow.python.eager import execute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\eager\execute.py", line 23, in <module> from tensorflow.python.framework import dtypes File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\dtypes.py", line 26, in <module> from tensorflow.python.lib.core import _pywrap_bfloat16 AttributeError: _ARRAY_API not found ImportError: numpy.core._multiarray_umath failed to import ImportError: numpy.core.umath failed to import Traceback (most recent call last): File "e:\tensflowcode\GoogLeNet-Inception-master\GoogLeNet-Inception-master\examples\inception_pretrained.py", line 11, in <module> import tensorflow as tf File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\__init__.py", line 37, in <module> from tensorflow.python.tools import module_util as _module_util File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\__init__.py", line 42, in <module> from tensorflow.python import data File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\__init__.py", line 21, in <module> from tensorflow.python.data import experimental File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\__init__.py", line 95, in <module> from tensorflow.python.data.experimental import service File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\service\__init__.py", line 387, in <module> from tensorflow.python.data.experimental.ops.data_service_ops import distribute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\ops\data_service_ops.py", line 22, in <module> from tensorflow.python.data.experimental.ops import compression_ops File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\experimental\ops\compression_ops.py", line 16, in <module> from tensorflow.python.data.util import structure File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\structure.py", line 22, in <module> from tensorflow.python.data.util import nest File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\data\util\nest.py", line 36, in <module> from tensorflow.python.framework import sparse_tensor as _sparse_tensor File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\sparse_tensor.py", line 24, in <module> from tensorflow.python.framework import constant_op File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\constant_op.py", line 25, in <module> from tensorflow.python.eager import execute File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\eager\execute.py", line 23, in <module> from tensorflow.python.framework import dtypes File "E:\tensflowcode\GoogLeNet-Inception-master\.goog\lib\site-packages\tensorflow\python\framework\dtypes.py", line 29, in <module> _np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle? 什么错误啊?
07-30
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值