关于在 mac上配置pytesseract的相关问题

因为踩了两个小时坑 特别是在配置依赖tesseract-ORC识别库时候的问题 特别麻烦

一定要用brewhome 一定要用brewhome 一定要用brewhome

重要的事情说三遍。

刚开始我在网上查了一下依赖的关系,觉得不是很难 然后 去下载源码下来编译 各种出问题。最后也没能解决,

所以推荐盆友们还是 使用 brewhome来安装吧 稍微方便一点。

要安装的 是这些玩意儿。

autoconf    jpeg        libpng        libtool
automake    leptonica    libtiff        tesseract

特别注意  在安装tesseract之前 要先安装leptonica

使用brewhome是比较方便的 直接使用命令

brew install leptonic

就可以了

最后安装tesseract 使用命令

brew install tesseract

这时候会出现这个报错

Error: You must `brew link leptonica' before tesseract can be installed

然后使用命令 

brew link tesseract

又会报错。。。

rror: Could not symlink bin/convertfilestopdf
Target /usr/local/bin/convertfilestopdf
already exists. You may want to remove it:
  rm '/usr/local/bin/convertfilestopdf'

To force the link and overwrite all conflicting files:
  brew link --overwrite leptonica

To list all files that would be deleted:
  brew link --overwrite --dry-run leptonica

这里按照提示来  有好几个选择 我直接使用的 link 强制覆盖操作

brew link --overwrite leptonica

然后 再重新执行

brew install tesseract

就可以安装成功啦

其实配置这些 只是 为了安装python的 pytesseract模块的支持。 python在使用这个模块的时候 还需要PIL库的支持,这里我就不赘述了。。大家自己再去找别的资料吧 反正最麻烦的 绝对是pytesseract-orc这个模块,其他的应该都可以使用pip install解决。


原文地址:https://www.cnblogs.com/piperck/p/4966464.html