pytesseract.pytesseract.TesseractError ╰+攻爆jí腚メ 2022-05-30 00:24 215阅读 0赞 pytesseract.pytesseract.TesseractError: (1, 'Error opening data file /usr/local/Cellar/tesseract/3.05.01/share/tessdata/chi_sim.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory. Failed loading language \'chi_sim\' Tesseract couldn\'t load any languages! Could not initialize tesseract.') 首先是安装: brew install tesseract 解决办法: 1、要设置环境变量 TESSDATA\_PREFIX,它的值为tessdata目录 2、因为要用tesseract来识别中文所以需要chi\_sim语言包支持 ### 一、tessdata目录 ### #### 1.1 可能在/usr/share/tesseract #### #### 1.2 可能在/usr/local/Cellar/里 #### 由于我是brew 安装所以我的目录是第二种 export TESSDATA_PREFIX=/usr/local/Cellar/tesseract/3.05.01/share/tessdata export PATH=$PATH:$TESSDATA_PREFIX ### 二、chi\_sim下载 ### 现在tesseract 被托管到github上 [https://github.com/tesseract-ocr/tessdata][https_github.com_tesseract-ocr_tessdata] 然后看到里面可以下载相应的语言包 **注意,上面的链接滑到底有提示** These language data files only work with Tesseract 4. They are based on the sources in tesseract-ocr/langdata on GitHub. Get language data files for Tesseract 3.04 or 3.05 from the 3.04 tree. More information and a complete list of all languages is available in the Tesseract wiki. 由于版本问题所以需要到对应的连接进行下载。 支持的语言查看 tesseract --list-langs 显示: List of available languages (3): chi\_sim eng osd 终于ok了,不过识别率一般般吧,不是很理想 以上就是我解决问题的过程,如果对你有所帮助,希望你点个赞O(∩\_∩)O 参考链接: [http://xiaosheng.me/2015/12/18/article10/][http_xiaosheng.me_2015_12_18_article10] [https://tonydeng.github.io/2016/07/28/on-the-use-of-tesseract-picture-text-recognition/][https_tonydeng.github.io_2016_07_28_on-the-use-of-tesseract-picture-text-recognition] [https_github.com_tesseract-ocr_tessdata]: https://github.com/tesseract-ocr/tessdata [http_xiaosheng.me_2015_12_18_article10]: http://xiaosheng.me/2015/12/18/article10/ [https_tonydeng.github.io_2016_07_28_on-the-use-of-tesseract-picture-text-recognition]: https://tonydeng.github.io/2016/07/28/on-the-use-of-tesseract-picture-text-recognition/
还没有评论,来说两句吧...