No module named pytesseract error

droledenom picture droledenom · Nov 19, 2017 · Viewed 9.6k times · Source

I am trying to use pytesseract for OCR, on a raspberry pi using Raspbian

I have read several questions on this topic, but can't find an answer that works, they usually say to install pytesseract with pip, and I did it.

my code is very simple:

import pytesseract
from PIL import Image
print(pytesseract.image_to_string(Image.open('test.jpg')))

But it returns error message : "ImportError: No module named 'pytesseract' .

I have installed tesseracrt-ocr (the whereis tesseract-ocr command returns /usr/share/tesseract-ocr)

I have installed pytesseract with pip install tesseract (which returns successfully installed Pillow-4.3.0 olefile-0.44 pytesseract-0.1.7 ... but the whereis pytesseract command does not return anything --> a problem?).

Do you have any idea of the problem I have ?

Answer

csharpcoder picture csharpcoder · Nov 29, 2017

See after installing pytesseract ,using

<cmd>C:\> pip install pytesseract

Try :

import pytesseract

If above is not working then it has do something with the installation , Check if pytesseract folder is available under "\Python27\Lib\site-packages" ,

Try the above command from site packages, Hope this helps , Else there is something wrong with installation .