Centos7 安装 tesseract-ocr 4 及 pytesseract

1.   下载tesseract-ocr源码

git clone -b master https://github.com/tesseract-ocr/tesseract.git tesseract-ocr

 

2.   安装g++

yum install gcc gcc-c++ make

 

3.   安装autoconf automake libtool libjpeg-devellibpng-devel libtiff-devel zlib-devel

yum installautoconf automake libtool

yum installlibjpeg-devel libpng-devel libtiff-devel zlib-devel

 

4.   安装leptonica

wget http://www.leptonica.org/source/leptonica-1.76.0.tar.gz

解压后 进入目录后依次执行:

./configure

make

make install

 

编译完成后使用vim增加如下三个变量:

vim /etc/profile

 exportLD_LIBRARY_PATH=$LD_LIBRARY_PAYT:/usr/local/lib

export LIBLEPT_HEADERSDIR=/usr/local/include
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig


保存后执行: source /etc/profile

5.   进入第1步下载的tesseract-ocr目录依次执行如下命令:

./autogen.sh

./configure

make

make install

 

6.   安装pytesseract

pip installpytesseract

你可能感兴趣的:(Shell)