【问题标题】:Unable to setup "sphinx" on gitlab-ci无法在 gitlab-ci 上设置“狮身人面像”
【发布时间】:2019-01-25 19:50:51
【问题描述】:

无法在 gitlab-ci 上设置 sphinx

我正在尝试在 gitlab-ci 上设置和运行 sphnix。它安装在我的本地机器上,服务器工作正常。但不是在 gitlab-ci

这是我的 gitlab-ci 的一部分:

  before_script:
    - apt-get update -qq && apt-get install -yqq [......] python-pip
    - pip install sphinx

    # ..........
    - bundle exec rake ts:index
    - bundle exec rake ts:start

安装sphinx的输出:

$ pip install sphinx
Downloading/unpacking sphinx
[................]
Installing collected packages: sphinx, babel, [.............]
Compiling /tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncfilters.py ...
  File "/tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncfilters.py", line 7
    async def auto_to_seq(value):
            ^
SyntaxError: invalid syntax

Compiling /tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncsupport.py ...
  File "/tmp/pip-build-V2Tzes/Jinja2/jinja2/asyncsupport.py", line 22
    async def concat_async(async_gen):
            ^
SyntaxError: invalid syntax

  Running setup.py install for MarkupSafe

    building 'markupsafe._speedups' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c markupsafe/_speedups.c -o build/temp.linux-x86_64-2.7/markupsafe/_speedups.o
    markupsafe/_speedups.c:12:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.


    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Plain-Python installation succeeded.
    ==========================================================================
Successfully installed sphinx babel sphinxcontrib-websupport Jinja2 alabaster imagesize Pygments snowballstemmer docutils packaging typing pytz MarkupSafe pyparsing
Cleaning up...

如您所见,成功了。

但是,当它到达这一点时,它会失败:

  $ bundle exec rake ts:index
  Generating configuration to /builds/my_user/my_ap123/config/test.sphinx.conf
  sh: 1: indexer: not found

  The Sphinx indexing command failed:
    Command: indexer --config "/builds/my_user/my_ap123/config/test.sphinx.conf" --all
    Status:  127
    Output:  See above

这是为什么呢?如何解决?

【问题讨论】:

  • 您似乎混淆了两个名为 Sphinx 的工具。 pip install sphinx 安装 Sphinx 文档生成器 (sphinx-doc.org)。但我怀疑你真的想安装 Sphinx 搜索引擎 (sphinxsearch.com)。
  • @mzjn,是的。如何安装Sphinx search engine
  • @mzjn,没错,但我的系统不是 ubuntu 或其他。这是 gitlab-ci。
  • 很抱歉,我无法为您提供帮助。我刚刚注意到您尝试安装错误的 Sphinx。

标签: python continuous-integration gitlab sphinx gitlab-ci


【解决方案1】:

pip install sphinx 没有完全成功。在安装过程中,它抱怨缺少Python.h

致命错误:Python.h:没有这样的文件或目录

还需要安装python的开发包。 对于 python3x 使用

sudo apt-get install python3-dev

对于 python2x 使用

sudo apt-get install python-dev

您可以添加到before_script

before_script:
    - apt-get update -qq && apt-get install -yqq [......] python-pip python3-dev
    - pip install sphinx

更新

要使用 gitlab ci 安装 sphinx 搜索引擎,请按如下方式更新您的 before_script

before_script:
    - add-apt-repository ppa:builds/sphinxsearch-rel22 sphinxsearch
    - apt-get update -qq && apt-get install -yqq [......] python-pip python3-dev mysql-client unixodbc libpq5 
    - pip install sphinxsearch

【讨论】:

    猜你喜欢
    • 2010-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多