3

I tried with the solution given in 'stackoverflow', but not resolved.

I am trying to extract text from images with the help of pytesseract module from python.

The following are the steps I followed:

code:

py -m pip install --user virtualenv
py -m venv tessa #creating virtual environment
c:\Users\folder\tessa\Scripts>activate #activated virtual environment
(tessa) c:\Users\folder>jupyter notebook #initiated jupyter IDE
pip install opencv-python
pip install pytesseract
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\\Users\\folder\\subfolder\\Local\\Programs\\Tesseract-OCR\\tesseract.exe'

Now problem start as shown in the image uploaded here in.

error screen shot

Also showing error 'ModuleNotFoundError : No module named "Image"'

I am not able to fix this issue. Can anybody help on this error, to fix it?

Thanks a lot.

Miki
  • 40,887
  • 13
  • 123
  • 202
krishna
  • 401
  • 6
  • 16
  • did you try this? https://stackoverflow.com/questions/8863917/importerror-no-module-named-pil – Stepan Jan 12 '21 at 11:40

3 Answers3

2

It is saying that the module named Pillow(PIL) is missing. You can install it using pip. Enter the following in Command Line.

pip install Pillow
mzebin
  • 39
  • 1
  • 8
0

You are lacking the module Pillow. To install it you can run the following command in your command line:

py -m pip install Pillow

Make sure you are doing this when your environment is active (after using the activate command), otherwise you will be installing it on your Python globally.

Shunya
  • 2,344
  • 4
  • 16
  • 28
  • File "", line 1 py -m pip install Pillow ^ SyntaxError: invalid syntax – krishna Jan 12 '21 at 11:52
  • tried py -m pip install Pillow. Requirement already statisfied: Pillow in c:\users\..path\python\python39\lib\\site-packages (8.0.1) – krishna Jan 13 '21 at 09:56
  • pytesseract.pytesseract.tesseract_cmd = r'C:\\Users\\folder\\subfolder\\Local\\Programs\\Tesseract-OCR\\tesseract.exe'. In this path, subfolder is AppData in my system. Which is hidden one and admin handled access. – krishna Jan 13 '21 at 09:59
0

Some modules of Python are pre-installed, but no all. You can find modules index this official index. Then (if you have added pip to your path when you was installing Python), go to your terminal (cmd in Windows) and execute :

pip install [module_name]

Then don't forget to import it in your code

If you have want to share your projet, mark all modules used in a file named "requirements.txt" like that. Then the other user just have to execute

pip install -r requirements.txt

And modules will installed in the good version.

Quentin
  • 17
  • 2
  • 7