一、安裝
需要安裝兩個庫和一個識別引擎tesseract-ocr
1 pip install pytesseract 2 pip install pillow
windows安裝識別引擎,打開這個站點找到最新版下載后安裝即可:https://digi.bib.uni-mannheim.de/tesseract/
Mac安裝識別引擎建議用brew進行安裝:brew install tesseract
Tesseract默認是不支持中文的,如果想要識別中文或者其它語言需要下載相應的語言包,下載地址如下:https://tesseract-ocr.github.io/tessdoc/Data-Files
有兩個中文語言包:Chinese-Simplified和Chinese-Traditional,分別是簡體中文和繁體中文,選擇需要的下載即可。下載完成后需要放到Tesseract的路徑下的tessdata目錄下
mac下查看brew安裝包路徑:brew info tesseract(方便查找tessdata目錄可以用tree命令快速找到位置)
二、圖片文字識別


看來對中文的支持還不是很好啊🤦♂️
