0

我正在尝试部署一个用于图像识别的 Python 应用程序,它使用 tesseract、tesserocr 和 leptonica。但是在 Bluemix 上部署它时出现以下错误。

Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0jQxGj/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-yIT1DQ-record/install-record.txt --single-version-externally-managed --compile:
       pkg-config failed to find tesseract/lept libraries: Package tesseract was not found in the pkg-config search path.
       Perhaps you should add the directory containing `tesseract.pc'
       No package 'tesseract' found

       to the PKG_CONFIG_PATH environment variable
       Failed to extract tesseract version from executable: [Errno 2] No such file or directory
       Supporting tesseract v3.04.00
       Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 197632}}
       running install
       running build
       running build_ext
       building 'tesserocr' extension
       creating build
       creating build/temp.linux-x86_64-2.7
       gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c tesserocr.cpp -o build/temp.linux-x86_64-2.7/tesserocr.o
       cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
       tesserocr.cpp:555:34: fatal error: leptonica/allheaders.h: No such file or directory
        #include "leptonica/allheaders.h"
                                         ^
       compilation terminated.
       error: command 'gcc' failed with exit status 1
4

1 回答 1

1

看起来您正在使用的构建包没有编译 tesseract 所需的库。

您可以尝试不同的构建包,例如python-tesseract-buildpack。请注意,这个 buildpack 与它最初派生出来的python-buildpack已经过时了(cloudfoundry:master 后面的 407 次提交)。

如果上述 buildpack 适合您,您可能希望基于最新的 python buildpack 以及 python-tesseract-buildpack 对其所做的更改来创建自己的自定义 buildpack。这里有关于 buildpack 的更多信息:

于 2017-10-31T17:07:51.823 回答