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/releases
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
https://github.com/tesseract-ocr/tessdata
5、测试
$ tesseract 0384.jpg stdout
0 3 8 4
图片
看报错路径,把eng.traineddata文件拷贝到缺失路径下,再次测试
参考: https://tesseract-ocr.github.io/tessdoc/Compiling.html#macos