centos7 system yum installs testeract, and pip installs testserocr of python3
September 4, 2018 00:00:27 reading: 15 label: centos7python3tesserocr More
Personal classification: python
Copyright notice: This is the original article of the blogger. It can't be reproduced without the permission of the blogger. https://blog.csdn.net/zyy247796143/article/details/82356867
#To install the epel source:
yum -y install epel-release
#To install testeract:
yum -y install tesseract
#To check the language supported by testeract:
tesseract --list-langs
List of available languages (1):
eng
It is found that currently only English is supported. To install more language packs, you can execute git to obtain:
-
git clone https://github.com/tesseract-ocr/tessdata.git
-
mv tessdata/* /usr/share/tesseract/tessdata
pip installation of pilot and tesserocr:
pip3 install pillow tesserocr
It is found that the pilot installation is successful, and the teserocr error is reported
Installing collected packages: tesserocr
Running setup.py install for tesserocr ... error
Complete output from command /usr/local/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-i48iarbe/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-p27b42h9/install-record.txt --single-version-externally-managed --compile:
pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path.\nPerhaps you should add the directory containing `tesseract.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'tesseract' found\n"
Supporting tesseract v3.04.00
Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 197632}}
/usr/local/python3/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_ext
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/python3/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o
tesserocr.cpp:597:34: fatal error: leptonica/allheaders.h: No such file or directory
#include "leptonica/allheaders.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-i48iarbe/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-p27b42h9/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-i48iarbe/tesserocr/
#To solve this problem, install the following testeract devel Library:
yum install tesseract-devel
#Then pip to install tesserocr:
pip3 install tesserocr
No mistake, finish!