這個錯誤相信是不少人安裝tesseract的時候要開始訓練ocr識別的時候會報的一個錯誤。 你想安裝訓練工具就會提示告訴你沒有--with-training-tools這個參數。找了好久,最後在網上找到一篇博客說要編譯安裝才行。 這篇博客的內容就是把我找到的那邊博客的內容複製了一遍,之因此這樣作是爲了其餘人遇到該問題的時候能更容易找到這個解決方式,畢竟多一篇blog答案就更容易找到, 若是這篇文章對你有幫助的話,仍是請移步到原做者那邊查看吧。原文地址git
解決方式:
1.安裝依賴github
# Packages which are always needed.
brew install automake autoconf libtool
brew install pkgconfig
brew install icu4c
brew install leptonica
# Packages required for training tools.
brew install pango
# Optional packages for extra features.
brew install libarchive
# Optional package for builds using g++.
brew install gcc
複製代碼
2.下載解壓tesseract-4.1.1.tar.gz github.com/tesseract-o…markdown
3.編譯安裝工具
cd tesseract-4.1.1
./autogen.sh
mkdir build
cd build
# Optionally add CXX=g++-8 to the configure command if you really want to use a different compiler.
../configure PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig
make -j
# Optionally install Tesseract.
sudo make install
# Optionally build and install training tools.
make training
sudo make training-install
複製代碼
4.下載eng.traineddata github.com/tesseract-o…oop
5.測試測試
$ tesseract 0384.jpg stdout
0 3 8 4
複製代碼