java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': Native library (darwin/libtesseract.dylib) not found in resource path ([file:/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/jre/lib/charsets.jar, file:/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/jre/lib/deploy.jar
发现mac系统使用test4j需要安装tesseract(参考 MAC系统中的JAVA中使用tess4j实现OCR识别的环境搭建(含tesseract安装配置)_deathearth的博客-CSDN博客_mac tess4j)
开淦
brew install tesseract
结果报了一堆错
==> Installing tesseract dependency: giflib
==> Pouring giflib-5.2.1.monterey.bottle.tar.gz
/usr/local/Cellar/giflib/5.2.1: 19 files, 583.6KB
==> Installing tesseract dependency: jpeg
==> Pouring jpeg-9e.monterey.bottle.tar.gz
/usr/local/Cellar/jpeg/9e: 21 files, 939.3KB
==> Installing tesseract dependency: libpng
==> Pouring libpng-1.6.37.monterey.bottle.tar.gz
/usr/local/Cellar/libpng/1.6.37: 27 files, 1.3MB
==> Installing tesseract dependency: libtiff
==> Pouring libtiff-4.3.0.monterey.bottle.tar.gz
/usr/local/Cellar/libtiff/4.3.0: 249 files, 4.4MB
==> Installing tesseract dependency: little-cms2
==> Pouring little-cms2-2.13.1.monterey.bottle.tar.gz
/usr/local/Cellar/little-cms2/2.13.1: 21 files, 1.3MB
==> Installing tesseract dependency: openjpeg
==> Pouring openjpeg-2.4.0.monterey.bottle.tar.gz
Error: No such file or directory @ rb_sysopen - /Users/francischeung/Library/Caches/Homebrew/downloads/f59513630f4d903a86aea8ff67226fbf7aa362527b275840ada0d52b8a373ab1--openjpeg-2.4.0.monterey.bottle.tar.gz
试了几次,都是卡在openjpeg这里,因此单独安装openjpeg
brew install openjpeg
openjpeg安装成功,再执行brew install tesseract
查看tesseract版本
tesseract -v
tesseract 5.1.0
leptonica-1.82.0
libgif 5.2.1 : libjpeg 9e : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 1.2.2 : libopenjp2 2.4.0
Found AVX2
Found AVX
Found FMA
Found SSE4.1
Found libarchive 3.6.1 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8 liblz4/1.9.3 libzstd/1.5.2
Found libcurl/7.79.1 SecureTransport (LibreSSL/3.3.5) zlib/1.2.11 nghttp2/1.45.1
大功告成!