How to install tesserocr on windows?
Asked Answered
O

4

8

I downloaded executable file of tesseract-OCR and installed it. On the other hand, I also downloaded a zipfile of leptonica from http://www.leptonica.com/download.html. It includes two directory that is lib and include.

Next I tried to do pip install tesserocr in a python virtualenvironment and it returned error

 tesserocr.cpp(460) : fatal error C1083: Cannot open include file: 'leptonica/allheaders.h': No such file or directory

I noticed that allheaders.h is in include directory from the leptonica file I downloaded earlier. How do I solve this? Where should I put the directory include and lib I got from leptonica to make this work?

Is there any other way to install tesseract-ocr and use tesserocr properly on windows computer? Currently I am using Windows 10 to run my python script that use tesseract-ocr to recognize some character on image. I also plan to run the script on windows 7 computer later.

Thank you for your help.

Offenseless answered 7/6, 2017 at 6:55 Comment(0)
L
7

Use Anaconda to install TesserOCR in an environment named OCR

  1. Install Anaconda for Windows from here
  2. Open Anaconda Prompt:

    conda create -n OCR python=3.6

    activate OCR

  3. For tesseract 3.5.1 (stable):

    conda install -c simonflueckiger tesserocr

    OR for tesseract 4.0.0 (experimental):

    conda install -c simonflueckiger/label/tesseract-4.0.0-master tesserocr

    OR download the wheel file matching your Windows platform and Python installation from here and install it via:

    pip install <path_to_your_wheel_file>

Lock answered 10/3, 2018 at 11:51 Comment(2)
I did this but it still has the same error about not having leptonica.Frodi
I did not face this issue but you could try these: github.com/tesseract-ocr/tesseract/issues/… github.com/tesseract-ocr/tesseract/wiki/CompilingLock
N
1

I know it is too late for you but it might help others.

Installation of leptonica will not be a complete solution at all in order to remove error while installing tesseract-ocr. After the installation of tesseract using windows installer available here, you should install the python wrapper as:

pip install pytesseract

Last but not least, you should also set the tesseract path in your script after importing pytesseract library as below (Please do not forget that installation path might be modified in your case!):

pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'
Nerine answered 4/9, 2020 at 7:58 Comment(0)
S
0

This method works for me perfectly: Use Anaconda to install TesserOCR in an environment named OCR

Install Anaconda for Windows from here

Open Anaconda Prompt:

conda create -n OCR python=2.7

activate OCR

You should install Anaconda and tesserac

https://www.anaconda.com/distribution/#download-section and in the prompt command write

conda install -c simonflueckiger tesserocr

conda install -c simonflueckiger/label/tesseract-4.0.0-master tesserocr
Sourwood answered 6/3, 2019 at 16:53 Comment(1)
I did this but it still has the same error about not having leptonica.Frodi
L
-2

Basically,To install any pacakge on windows , go to LIBS location and run the command

 "py -3.4 -m pip install SomePackage"

for tesseract either follow here : http://emop.tamu.edu/Installing-Tesseract-Windows8

OR

Download set up from here ( https://pypi.python.org/pypi/pytesseract) and double click on set up. Hope it helps.

Lunge answered 8/8, 2017 at 5:29 Comment(1)
pytesseract and tesserocr are differentPeriodontics

© 2022 - 2024 — McMap. All rights reserved.