Spring Boot tess4j 報Unable to load library 'tesseract': Native library解決方法
這個錯誤原因是在服務器上沒有安裝tesseract
(1)如果服務器是ubuntu,那麼運行下面這個命令:
sudo apt-get install tesseract-ocr
(2)如果服務器是CentOS的話,查了許多資料,看似解決起來很麻煩,但是實際上只運行下面這個命令即可:
yum install tesseract
(3)但是我的開發電腦是MAC,這就尷尬了。其實,是因爲在Mac上需要安裝tesseract,解決辦法查看官方wiki:https://github.com/tesseract-ocr/tesseract/wiki
可以使用brew安裝
brew install tesseract
如果brew安裝很慢的話可以參考:Mac 解決brew一直卡在Updating Homebrew
安裝時如果提示:
$ brew install tesseract
Error: The following directories are not writable by your user:
/usr/local/include
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/include
此時終端執行(異常提示中已經告訴要執行的命令了):
$ sudo chown -R `whoami`:admin /usr/local/include
解決!安裝成功後,就可以寫代碼了
新建maven工程
參考了好多資料,鏈接放在下面,如果上面的方法解決不了就去下面的網站去查吧
https://groups.google.com/forum/#!msg/tesseract-ocr/u-PZaakaKs0/unWFARYUBQAJ;context-place=forum/tesseract-ocr (主要是看這個解決的centOS的問題)
https://stackoverflow.com/questions/26577644/tess4j-native-library-linux-x86-64-libtesseract-so-not-found-in-resource-pat (主要是看這個解決的ubuntu的問題)
原文鏈接:https://blog.csdn.net/zhichicao/article/details/81870075