Moondra
Moondra

Reputation: 4531

Can't seem to run tesseract from command line despite adding PATH

I'm trying to add tesseract to be able to install pytesseract. I use Windows 7.

I add this path to my PATH environmental variable C:\Program Files (x86)\Tesseract-OCR\tesseract.exe

From the command line if I run

tesseract DMTX_screenshot.png out OR tesseract

I'm getting

tesseract is not recognized as an internal or external command.

Here is a copy-paste of the a portion of my environmental variable:

C:\Program Files (x86)\Tesseract-OCR\tesseract.exe;C:\Users\Moondra\Anaconda_related\Anaconda\geckodriver.exe;

Any ideas as to what I may be doing wrong?

Thank you.

Upvotes: 13

Views: 48298

Answers (9)

Hitesh Lalwani
Hitesh Lalwani

Reputation: 39

I founded the solution for this problem and this works fine almost in all situations.

Step 1: download tesseract ocr from https://github.com/UB-Mannheim/tesseract/wiki and install it.

Step 2: note the installation directory while installing and then add path to env variables.

Step 3: run "pip install pyteseract" in cmd or any terminal.

And you are done. Just be make sure to add same directory location of tesseract ocr in your code and add tesseract.exe after it.

Upvotes: 0

Rahul Dhankhar
Rahul Dhankhar

Reputation: 93

I was also having this problem initially. Don't install tesseract via pip install tesseract.

Go to https://github.com/UB-Mannheim/tesseract/wiki and then download latest version for your computer and install that.

Then type sysdm.cpl and add the directory where tesseract.exe is present to env. variables.

for eg: C:\Program Files\Tesseract-OCR

This solved it for me.

Upvotes: 1

J Wolfe
J Wolfe

Reputation: 93

After adding tesseract to PATH, make sure you restart your PC. It only worked after the restart.

Upvotes: 4

Kream
Kream

Reputation: 131

Add C:\msys64\mingw32\bin to PATH variable in case you've installed it using pacman or msys2.

Upvotes: 0

Ishani
Ishani

Reputation: 49

Go to the location where you have installed Tesseract-OCR on the terminal and then type tesseract -v. This worked for me.

Upvotes: -1

Alex Lev
Alex Lev

Reputation: 31

Just add the folder to the Path under Windows (not sure with Win7):

Control Panel > System and Security > System >

Advanced system settings > Advanced > Environment variables > PATH > New

Upvotes: 3

ricardo valadez
ricardo valadez

Reputation: 71

The solution is the following you have to add cd first ...

Example:

cd C:\Program Files (x86)\Tesseract-OCR

C:\Program Files (x86)\Tesseract-OCR> tesseract --version

Upvotes: 7

Moondra
Moondra

Reputation: 4531

So It seems there are two version for Windows, 4.00 and 3.05 -- 4.00 is still buggy. I installed the 3.05 version and seems to work fine now.

Here is where I got the 3.05 version.

https://github.com/UB-Mannheim/tesseract/wiki

Upvotes: 3

nguyenq
nguyenq

Reputation: 8365

The PATH variable should include directories only, not files, such as C:\Program Files (x86)\Tesseract-OCR.

Upvotes: 13

Related Questions