【问题标题】:how to extract text from scanned documents using python如何使用python从扫描的文档中提取文本
【发布时间】:2017-04-12 08:01:53
【问题描述】:

我试过这个例子,https://github.com/madmaze/pytesseract

import Image
import pytesseract

print pytesseract.image_to_string(Image.open('image1.png'))

出现错误: _execute_child raise child_exception OSError: [Errno 2] No such file or directory

中的文件“/usr/lib/python2.7/subprocess.py”,第 1327 行

还有其他方法可以从扫描的文档中提取文本吗?

【问题讨论】:

  • 这样有什么问题?
  • 文件“/usr/lib/python2.7/subprocess.py”,第 1327 行,在 _execute_child raise child_exception OSError: [Errno 2] No such file or directory
  • 收到此错误
  • 你是如何安装 pytesseract 的?你用过点子吗?你的操作系统是什么?从堆栈跟踪看起来像 linux?在诊断这个问题时,这些都是有帮助的。
  • yes ubuntu 14.04 并使用 pip 安装它

标签: python image-processing machine-learning stanford-nlp tesseract


【解决方案1】:

我发现了问题,

更新:

/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py

tesseract_cmd = 'tesseract' =====>> tesseract_cmd = '/usr/local/bin/tesseract'

现在它开始工作了。

【讨论】:

  • 这很奇怪,/usr/local/bin 默认应该在你的搜索路径中。
  • 我试过了,但准确度较低,任何其他可用于相同功能的软件包。
【解决方案2】:

使用下面的命令

sudo apt-get install tesseract-ocr

【讨论】:

  • 从回溯和后续讨论中可以看出,问题与PIL/pillow完全无关。
猜你喜欢
  • 2019-08-12
  • 1970-01-01
  • 1970-01-01
  • 2015-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-04
  • 1970-01-01
相关资源
最近更新 更多