0
votes

I was using pytesseract for OCR from images. Everything was working fine .. till I tried pip install pillow and pip easy install pillow in my cmd just for trying a random crop . After that when I try to import pytesseract. It keeps throwing error

Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\pytesseract\pytesseract.py", line 28, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pytesseract
  File "C:\Python39\lib\site-packages\pytesseract\__init__.py", line 2, in <module>
    from .pytesseract import ALTONotSupported
  File "C:\Python39\lib\site-packages\pytesseract\pytesseract.py", line 30, in <module>
    import Image
ModuleNotFoundError: No module named 'Image'

Screenshot

1

1 Answers

0
votes

You are using Python 3.9 version. Pillow is compatible with that but only from v8. Check your pillow version. If its below 8, update it using:

>>pip install --upgrade Pillow

Moreover, if the 2nd error still persists, try this:

from PIL import Image instead of import Image