如何在Windows上使用python运行tesseract OCR?

时间:2018-04-07 11:38:00

标签: python ocr tesseract

我安装了所有包装。 下面是代码:

from PIL import Image
import pytesseract

im = Image.open("sample1.jpg")

text = pytesseract.image_to_string(im, lang = 'eng')

print(text)

,错误是:

Traceback (most recent call last):
  File "C:\Users\Usama Malik\Desktop\New folder (3)\tesseract-python-master\image_example.py", line 2, in <module>
    import pytesseract
  File "C:\Python27\lib\site-packages\pytesseract\__init__.py", line 1, in <module>
    from .pytesseract import (
  File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 9, in <module>
    import Image
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 27, in <module>
    from . import VERSION, PILLOW_VERSION, _plugins
ValueError: Attempted relative import in non-package

0 个答案:

没有答案