macOS MoJave
采取动态库方式
➜ 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 <module>
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
➜ 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 <module>
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)