1、安裝依賴
# 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
https://github.com/tesseract-ocr/tesseract/releases3、編譯安裝
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
https://github.com/tesseract-ocr/tessdata5、測試
$ tesseract 0384.jpg stdout
0 3 8 4
圖檔
看報錯路徑,把eng.traineddata檔案拷貝到缺失路徑下,再次測試
參考: https://tesseract-ocr.github.io/tessdoc/Compiling.html#macos