在Bluemix上部署时,tesseract / tesserocr / leptonica软件包在Python应用程序中失败

时间:2017-10-30 03:42:08

标签: python ibm-cloud tesseract leptonica

我正在尝试部署一个用于图像识别的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

1 个答案:

答案 0 :(得分:1)

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

您可以尝试使用其他构建包,例如python-tesseract-buildpack。请注意,这个buildpack与它最初分叉的python-buildpack完全过时了(407提交在cloudfoundry:master之后)。

如果上面的buildpack适合你,你可能想要根据最新的python buildpack以及python-tesseract-buildpack对它做出的改变来创建你自己的自定义buildpack。这里有关于buildpack的更多信息: