MaxOS配置kudu环境安装kudu-python

MaxOS install kudu-client

sudo xcodebuild -license
sudo xcode-select --install
brew install autoconf automake cmake git krb5 libtool openssl pkg-config pstree
git clone https://github.com/apache/kudu
cd kudu
thirdparty/build-if-necessary.sh
mkdir -p build/release
cd build/release
../../thirdparty/installed/common/bin/cmake -S /Users/username/Self/kudu -DCMAKE_INSTALL_PREFIX=/Users/username/Self/kudu-release -DCMAKE_BUILD_TYPE=release -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -Wno-dev
make -j4

Configure KUDU_HOME enviroment variable

echo "KUDU_HOME='/User/username/Self/kudu'" >>.base_profile

Install kudu-python

pip install kudu-python

ImportError(Dynamic dependency library not loaded)

(python) lizhixingdeMacBook-Pro:~ yixin$ python -c "import kudu"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/username/Self/python-2.7.16/lib/python2.7/site-packages/kudu/init.py", line 18, in <module>
from kudu.client import (Client, Table, Scanner, Session, # noqa
ImportError: dlopen(/Users/username/Self/python-2.7.16/lib/python2.7/site-packages/kudu/client.so, 2): Library not loaded: @rpath/libkudu_client.0.dylib
Referenced from: /Users/username/Self/python-2.7.16/lib/python2.7/site-packages/kudu/client.so
Reason: image not found

Resolve the above error

otool -L /Users/username/Self/python-2.7.16/lib/python2.7/site-packages/kudu/client.so
install_name_tool -change @rpath/libkudu_client.0.dylib /Users/username/Self/kudu/build/latest/lib/exported/libkudu_client.0.dylib /Users/username/Self/python-2.7.16/lib/python2.7/site-packages/kudu/client.so

Kudu python operations

import kudu
kudu_master_addresses = ['10.143.131.219', '10.143.252.116', '10.143.252.117']
kudu_master_port = 7051
ks = kudu.connect(kudu_master_address, port=kudu_master_port, admin_timeout_ms=15, rpc_timeout_ms=2)

猜你喜欢

转载自blog.51cto.com/784687488/2622070
今日推荐