Answer the question
In order to leave comments, you need to log in
Error when installing tesseract-ocr module, how to solve?
Hello!
I ran into a problem, I'm trying to install the tesseract-ocr module via the command line. An error of the following nature appears:
ERROR: Command errored out with exit status 1:
command: 'c:\users\ohvshiy\pars\avitovagon\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"'; __file__='"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Ohvshiy\AppData\Local\Temp\pip-record-o8dmzbeq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\ohvshiy\pars\avitovagon\include\site\python3.7\tesseract-ocr'
cwd: C:\Users\Ohvshiy\AppData\Local\Temp\pip-install-_cm9i1xq\tesseract-ocr\
Complete output (14 lines):
running install
running build
running build_py
file tesseract_ocr.py (for module tesseract_ocr) not found
file tesseract_ocr.py (for module tesseract_ocr) not found
running build_ext
building 'tesseract_ocr' extension
creating build
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\ohvshiy\pars\avitovagon\include -IC:\Users\Ohvshiy\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\Ohvshiy\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" /EHsc /Tptesseract_ocr.cpp /Fobuild\temp.win32-3.7\Release\tesseract_ocr.obj
tesseract_ocr.cpp
tesseract_ocr.cpp(631): fatal error C1083: ЌҐ г¤ Ґвбп ®вЄалвм д ©« ўЄ«о票Ґ: leptonica/allheaders.h: No such file or directory,
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\ohvshiy\pars\avitovagon\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"'; __file__='"'"'C:\\Users\\Ohvshiy\\AppData\\Local\\Temp\\pip-install-_cm9i1xq\\tesseract-ocr\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Ohvshiy\AppData\Local\Temp\pip-record-o8dmzbeq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\ohvshiy\pars\avitovagon\include\site\python3.7\tesseract-ocr' Check the logs for full command output.
Answer the question
In order to leave comments, you need to log in
Hello!
Try another method to install via Anaconda
1. Install anaconda https://www.anaconda.com/download/#windows
2. Open anaconda command line and type in two commands:
conda create -n OCR python=3.6
activate OCR
3. Install tesseract
conda install -c simonflueckiger tesserocr
one
two: pip install pytesseract pillow
example:
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Users\Violet\AppData\Local\Tesseract-OCR\tesseract.exe'
print(pytesseract.image_to_string(Image.open(r'img\driver_fr\777.jpg'), lang="rus"))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question