解决Mac安装tesserocr报错问题 Failed building wheel for

Posted jerryspace

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决Mac安装tesserocr报错问题 Failed building wheel for相关的知识,希望对你有一定的参考价值。

localhost:~ jerry$ Processing /var/www/git/python/tesserocr

-bash: Processing: command not found

localhost:~ jerry$ pip3 install tesserocr

Collecting tesserocr

  Using cached https://files.pythonhosted.org/packages/f8/6d/4e81e041f33a4419e59edcb1dbdf3c56e9393f60f5ef531381bd67a1339b/tesserocr-2.3.1.tar.gz

Building wheels for collected packages: tesserocr

  Running setup.py bdist_wheel for tesserocr ... error

  Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__=‘/private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-install-v4ek5yfd/tesserocr/setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘ ‘, ‘ ‘);f.close();exec(compile(code, __file__, ‘exec‘))" bdist_wheel -d /private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-wheel-u4i9uj2o --python-tag cp37:

  /private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-install-v4ek5yfd/tesserocr/setup.py:132: DeprecationWarning: The ‘warn‘ method is deprecated, use ‘warning‘ instead

    _LOGGER.warn(‘pkg-config failed to find tesseract/lept libraries: {}‘.format(e))

  pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path. Perhaps you should add the directory containing `tesseract.pc‘ to the PKG_CONFIG_PATH environment variable No package ‘tesseract‘ found "

  Supporting tesseract v4.0.0

  Building with configs: {‘libraries‘: [‘tesseract‘, ‘lept‘], ‘cython_compile_time_env‘: {‘TESSERACT_VERSION‘: 262144}}

  running bdist_wheel

  running build

  running build_ext

  building ‘tesserocr‘ extension

  creating build

  creating build/temp.macosx-10.7-x86_64-3.7

  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/include/python3.7m -c tesserocr.cpp -o build/temp.macosx-10.7-x86_64-3.7/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE

  warning: include path for stdlibc++ headers not found; pass ‘-std=libc++‘ on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

  In file included from tesserocr.cpp:603:

  /usr/local/include/tesseract/unichar.h:24:10: fatal error: ‘cstring‘ file not found

  #include <cstring>

           ^~~~~~~~~

  1 warning and 1 error generated.

  error: command ‘gcc‘ failed with exit status 1

  

  ----------------------------------------

  Failed building wheel for tesserocr

  Running setup.py clean for tesserocr

Failed to build tesserocr

Installing collected packages: tesserocr

  Running setup.py install for tesserocr ... error

    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__=‘/private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-install-v4ek5yfd/tesserocr/setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘ ‘, ‘ ‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record /private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-record-1cw_w_lk/install-record.txt --single-version-externally-managed --compile:

    /private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-install-v4ek5yfd/tesserocr/setup.py:132: DeprecationWarning: The ‘warn‘ method is deprecated, use ‘warning‘ instead

      _LOGGER.warn(‘pkg-config failed to find tesseract/lept libraries: {}‘.format(e))

    pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path. Perhaps you should add the directory containing `tesseract.pc‘ to the PKG_CONFIG_PATH environment variable No package ‘tesseract‘ found "

    Supporting tesseract v4.0.0

    Building with configs: {‘libraries‘: [‘tesseract‘, ‘lept‘], ‘cython_compile_time_env‘: {‘TESSERACT_VERSION‘: 262144}}

    running install

    running build

    running build_ext

    building ‘tesserocr‘ extension

    creating build

    creating build/temp.macosx-10.7-x86_64-3.7

    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/include/python3.7m -c tesserocr.cpp -o build/temp.macosx-10.7-x86_64-3.7/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE

    warning: include path for stdlibc++ headers not found; pass ‘-std=libc++‘ on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

    In file included from tesserocr.cpp:603:

    /usr/local/include/tesseract/unichar.h:24:10: fatal error: ‘cstring‘ file not found

    #include <cstring>

             ^~~~~~~~~

    1 warning and 1 error generated.

    error: command ‘gcc‘ failed with exit status 1

    

    ----------------------------------------

Command "/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__=‘/private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-install-v4ek5yfd/tesserocr/setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘ ‘, ‘ ‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record /private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-record-1cw_w_lk/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b_/dgk5x9dx6bx69rhw7v6dhgtw0000gn/T/pip-install-v4ek5yfd/tesserocr/

 

看了下网上的搜索结果,发现原来是我安装了Anaconda的原因。同时,也找到了解决方法

conda install -c simonflueckiger tesserocr

查了下conda install 发现conda是针对于python的。可以安装minconda或anaconda进行安装。所以在安装了Anaconda的条件下,我们可以通过conda install安装tesserocr

 

参考链接地址:http://mkd.pub/chl434723646/415732_22875257.html

以上是关于解决Mac安装tesserocr报错问题 Failed building wheel for的主要内容,如果未能解决你的问题,请参考以下文章

安装tesserocr错误(未解决)

安装tesserocr的步骤和报错RuntimeError: Failed to init API, possibly an invalid tessdata path解决办法

Python3.6安装tesserocr遇到的问题

IDE安装完成无法打开,报错Fail load JVM DLL 问题与解决方案

win10下pip3安装tesserocr时报错

Python安装tesserocr遇到的各种问题及解决办法