当前位置:   article > 正文

编译可训练的tesseract时遇到的问题,tesseract-OCR,training-tool_you can not build training tools because of missin

you can not build training tools because of missing dependency. check config

(1)据查https://blog.csdn.net/weixin_39569611/article/details/87278729,今年很早就不能用brew install --with-training-tools tesseract 安装可训练的tesseract了,

 

 

(2)于是自行编译,根据https://github.com/tesseract-ocr/tesseract/wiki/Compiling#macos-with-homebrew 用homebrew安装:

Install dependencies

  1. brew install automake autoconf libtool
  2. brew install pkgconfig
  3. brew install icu4c
  4. brew install leptonica
  5. brew install gcc

Install Tesseract with training tools

brew install pango

Compile

git clone https://github.com/tesseract-ocr/tesseract/
cd tesseract
./autogen.sh
./configure CC=gcc-8 CXX=g++-8 CPPFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib
make -j
sudo make install  # if desired
make training # if installed with training dependencies

(3)如果装不成功,执行一段来自https://github.com/tesseract-ocr/tesseract/wiki/TrainingTesseract-4.00#on-macos-mojave-with-homebrew的命令,也可以提前执行这个命令:

  1. brew install cairo pango icu4c autoconf libffi libarchive
  2. export PKG_CONFIG_PATH=\
  3. $(brew --prefix)/lib/pkgconfig:\
  4. $(brew --prefix)/opt/libarchive/lib/pkgconfig:\
  5. $(brew --prefix)/opt/icu4c/lib/pkgconfig:\
  6. $(brew --prefix)/opt/libffi/lib/pkgconfig
  7. ./configure

本人多次尝试,最终是安装成功,能够训练 *.traineddata.

 

(4)出错展示及解决,也即是用(3)中的代码解决了安装(2)时的错误。

  1. git clone https://github.com/tesseract-ocr/tesseract/
  2. cd tesseract
  3. ./autogen.sh
  4. ./configure CC=gcc-8 CXX=g++-8 CPPFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib
  5. make -j
  6. sudo make install # if desired make training # if installed with training dependencies

但编译时,在./configure**** 这一步出错,错误为:

........

checking for icu-i18n >= 52.1... no

configure: WARNING: icu 52.1 or higher is required, but was not found.

configure: WARNING: Training tools WILL NOT be built.

configure: WARNING: Try to install libicu-devel package.

checking for pango >= 1.22.0... no

configure: WARNING: pango 1.22.0 or higher is required, but was not found.

configure: WARNING: Training tools WILL NOT be built.

configure: WARNING: Try to install libpango1.0-dev package.

checking for cairo... no

configure: WARNING: Training tools WILL NOT be built because of missing cairo library.

configure: WARNING: Try to install libcairo-dev?? package.

checking that generated files are newer than configure... done

configure: creating ./config.status

config.status: creating Makefile

config.status: creating tesseract.pc

..............

config.status: executing libtool commands

 

Configuration is done.

You can now build and install tesseract by running:

 

$ make

$ sudo make install

$ sudo ldconfig

 

Documentation will not be built because asciidoc or xsltproc is missing.

 

You can not build training tools because of missing dependency. (警告中出现的那些找不到的dependency)

Check configure output for details.

 

 

主要是几个警告,导致最后出现You can not build training tools because of missing dependency.

然后按https://stackoverflow.com/questions/55361379/osx-compiling-training-tools-for-tesseract-4-0-pango-libraries-not-found执行

  1. brew install cairo pango icu4c autoconf libffi libarchive
  2. export PKG_CONFIG_PATH=\
  3. $(brew --prefix)/lib/pkgconfig:\
  4. $(brew --prefix)/opt/libarchive/lib/pkgconfig:\
  5. $(brew --prefix)/opt/icu4c/lib/pkgconfig:\
  6. $(brew --prefix)/opt/libffi/lib/pkgconfig
  7. ./configure

成功。实际上上段命令来自(3)。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/119831
推荐阅读
相关标签
  

闽ICP备14008679号