Bogdan Daniel Bogdan Daniel - 1 year ago 469
Linux Question

ImportError: No module named pytesseract

I was following this guide and got to the part where I run

python flask_server/
but I get

Traceback (most recent call last):
File "", line 3, in <module>
import pytesseract
ImportError: No module named pytesseract

How can I solve this ?

I also saw that I have multiple versions of python. I have linux-kali installed with the latest updates.

Something else: he runs the command like
python flask_server/
- where is that flask_server located ? I simply ran it like
(I was in some directory in which I created the file).

Answer Source

Python import errors usually boils down to one of those three cases (whether is is modules you developed; or modules distributed as packages):

  1. You did no install the required package. Googling pytesseracttells me its an OCR that is distributed and installable using Python package manager tool pip by running pip install pytesseract in your favorite shell.

  2. You did install the package, but is is not in your python path.

  3. (Less often) You did install the package, and it is in your python path, but you used a name already in user by Python, and the two are conflicting.

In your case, I strongly think this is the first one. Case 2. and 3. can be assessed by calling python -v your_script.pyas described in this answer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download