如何在Ubuntu16.04上用Python3.6安装xapian?

2024-04-19 15:53:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用ppa:jonathonf/python-3.6存储库在Docker上的Ubuntu16.04上安装了Python3.6。现在我想安装xapian,这样我就可以在Python中使用它了。我没有找到任何现成的包,所以我试图从源代码构建它。我设置了PYTHON3PYTHON3_LIB参数以指向python3.6。在构建过程中,我得到以下错误:

ImportError: libxapian.so.30: cannot open shared object file: No such file or directory

我尝试了xapian版本1.3.7和1.4.5,但运气不佳。在

如何安装xapian?在

下面是一个Dockerfile来重现我的错误:

FROM ubuntu:16.04
RUN apt-get update \
  && apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update \
  && apt-get install -y python3-pip docker.io python3.6 python3.6-dev software-properties-common \
      python-software-properties build-essential wget unzip cmake python3-sphinx \
  && cd /usr/local/bin \
  && ln -s /usr/bin/python3.6 python
RUN python -m pip install --upgrade pip

# install xapian 1.4.5
RUN apt-get update && apt-get install -y curl uuid-dev zlib1g-dev
WORKDIR /root
RUN curl --silent --show-error --fail --next -O https://oligarchy.co.uk/xapian/1.4.5/xapian-core-1.4.5.tar.xz
RUN curl --silent --show-error --fail --next -O https://oligarchy.co.uk/xapian/1.4.5/xapian-bindings-1.4.5.tar.xz
RUN tar xvf xapian-core-1.4.5.tar.xz
RUN tar xvf xapian-bindings-1.4.5.tar.xz
WORKDIR /root/xapian-core-1.4.5
RUN ./configure && make && make install
WORKDIR /root/xapian-bindings-1.4.5
RUN ./configure PYTHON3=/usr/bin/python3.6 PYTHON3_LIB=/usr/lib/python3.6 --with-python3 && make && make install
RUN python -c "import xapian"

Tags: installpiprungetmakeusraptupdate
1条回答
网友
1楼 · 发布于 2024-04-19 15:53:29

问题是Xapian库(libxapian.so.30)默认安装在/usr/local/lib中,但是Ubuntu不知道它已经被放在那里了。你可以通过添加:

RUN ldconfig

在安装核心之后(所以在您更改WORKDIR来构建绑定之前)。在

this Unix Stackexchange question的答案中有一些关于ldconfig和Ubuntu上的库搜索路径的有用信息。在

相关问题 更多 >