在Centos7上从源代码安装couchbase-python-client

时间:2015-10-06 20:08:05

标签: python couchbase libcouchbase

我试图在Centos7上安装couchbase python包。 libcouchbase和Python客户端似乎都没有问题地构建和安装,但是当我尝试在解释器中导入模块时,我得到:

Python 3.4.3 (default, Oct  6 2015, 15:22:55) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import couchbase
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/__init__.py", line 28, in <module>
    from couchbase.user_constants import *
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/user_constants.py", line 21, in <module>
    import couchbase._bootstrap
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/_bootstrap.py", line 34, in <module>
    import couchbase.exceptions as E
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/exceptions.py", line 18, in <module>
    import couchbase._libcouchbase as C
ImportError: libcouchbase.so.2: cannot open shared object file: No such file or directory

我正在构建libcouchbase:

cd /
git clone git://github.com/couchbase/libcouchbase.git
cd libcouchbase
mkdir build
/libcouchbase/cmake/configure
make && make install

构建python包:

cd /usr/local/lib/python3.4/site-packages
git clone git://github.com/couchbase/couchbase-python-client
cd couchbase-python-client
python3.4 setup.py build_ext --inplace --library-dir /usr/local/lib --include-dir /usr/local/include/libcouchbase
python3.4 setup.py install

我还尝试了没有标志的setup.py build

PYTHONPATH:

/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg
/usr/local/lib/python34.zip
/usr/local/lib/python3.4
/usr/local/lib/python3.4/plat-linux
/usr/local/lib/python3.4/lib-dynload
/usr/local/lib/python3.4/site-packages

$ PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

1 个答案:

答案 0 :(得分:1)

您应该将/usr/local/lib添加到LD_LIBRARY_PATH

在shell中运行命令:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib