rocketmq python client_启动rocketmq-client-python测试遇到的问题解决方法记录

环境和方式

macOS MoJave

采取动态库方式

error1

➜  test git:(master) ✗ /usr/bin/python TestSendMessages.py

__________Python Version:___________

2.7.10 (default, Aug 17 2018, 19:45:58)

[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]

______Add Path /usr/local/lib_______

Traceback (most recent call last):

File "TestSendMessages.py", line 19, in from librocketmqclientpython import *

ImportError: dlopen(/usr/local/lib/librocketmqclientpython.so, 2): Library not loaded: libboost_python.dylib

Referenced from: /usr/local/lib/librocketmqclientpython.so

Reason: unsafe use of relative rpath libboost_python.dylib in /usr/local/lib/librocketmqclientpython.so with restricted binary

解决

install_name_tool -change librocketmq.dylib /usr/local/lib/librocketmq.dylib /usr/local/lib/librocketmqclientpython.so

参考

https://www.jianshu.com/p/bfa05ef3c482

error2

➜  test git:(master) ✗ /usr/bin/python TestSendMessages.py

__________Python Version:___________

2.7.10 (default, Aug 17 2018, 19:45:58)

[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]

______Add Path /usr/local/lib_______

Traceback (most recent call last):

File "TestSendMessages.py", line 19, in from librocketmqclientpython import *

ImportError: dlopen(/usr/local/lib/librocketmqclientpython.so, 2): Library not loaded: libboost_python.dylib

Referenced from: /usr/local/lib/librocketmqclientpython.so

Reason: unsafe use of relative rpath libboost_python.dylib in /usr/local/lib/librocketmqclientpython.so with restricted binary

解决

➜  test git:(master) ✗ install_name_tool -change libboost_python.dylib /usr/local/lib/libboost_python.dylib /usr/local/lib/librocketmqclientpython.so

参考

https://blog.csdn.net/robertsong2004/article/details/54911034

查看库依赖

➜  lib otool -L librocketmq.dylib

librocketmq.dylib:

@rpath/librocketmq.dylib (compatibility version 0.0.0, current version 0.0.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)

/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)

➜  lib otool -L librocketmqclientpython.so

librocketmqclientpython.so:

@rpath/librocketmqclientpython.so (compatibility version 0.0.0, current version 0.0.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)

/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)

@rpath/librocketmq.dylib (compatibility version 0.0.0, current version 0.0.0)

libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)

/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)

/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值