12

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.

Moondra
  • 4,399
  • 9
  • 46
  • 104

9 Answers9

12

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

nguyenq
  • 8,212
  • 1
  • 16
  • 16
  • 3
    Thank you for the reply. Just tried, doesn't seem to make a difference. My webdriver (for seleium) has an exe. file assigned as the value for the PATH variable and seems to work perfectly. – Moondra May 04 '17 at 17:02
7

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
rkta
  • 3,959
  • 7
  • 25
  • 37
3

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

Moondra
  • 4,399
  • 9
  • 46
  • 104
  • 3
    Update 20 June 2018 - version 4.00 runs after updating Windows 10 PATH to include location of Tesseract executable. – Evan Jun 20 '18 at 22:48
3

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

J Wolfe
  • 83
  • 9
2

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

E.Coms
  • 11,065
  • 2
  • 23
  • 35
Alex Lev
  • 21
  • 2
1

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.

0

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

Kream
  • 131
  • 1
  • 3
  • 12
0

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.

-1

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

Ishani
  • 39
  • 2