OCRmyPDF 安装详解

概述


支持的操作系统:


windows 10 下安装部署:
windows下需要安装vc++ 2014版本.

C:\Windows\System32>ver

Microsoft Windows [版本 10.0.14393]

windows下需要安装tesseract版本的软件:
https://github.com/UB-Mannheim/tesseract/wiki

tesseract-ocr:


C:\Windows\System32>pip install ocrmypdf


C:\Windows\System32>pip list | findstr "img2pdf lxml ocrmypdf pdfminer pikepdf pycryptodome reportlab ruffus sortedcontainers chardet pycparser six olefile pillow"
cchardet                    2.1.4
chardet                     3.0.4
img2pdf                     0.3.3
lxml                        4.3.3
ocrmypdf                    8.2.4
olefile                     0.44
pdfminer.six                20181108
pikepdf                     1.3.0
pycparser                   2.19
pycryptodome                3.8.1
reportlab                   3.5.21
ruffus                      2.8.1
six                         1.11.0
sortedcontainers            2.1.0



CentOS 7版本:
使用EPEL repo:
# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core) 


# yum -y install python36 python36-pip python36-devel

# python3 -V
Python 3.6.6
# pip3 -V
pip 8.1.2 from /usr/lib/python3.6/site-packages (python 3.6)

# pip3 install --upgrade pip

# pip -V
pip 19.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)


需求:
Python 3.6 or newer
Ghostscript 9.15 or newer
qpdf 8.1.0 or newer
Tesseract 4.0.0-alpha or newer

安装需要依赖的软件包:
# yum -y install gcc gcc-c++ cpp libgcc libgomp libstdc++ libstdc++-devel

# yum -y install ghostscript ghostscript-chinese ghostscript-devel ghostscript-chinese-zh_CN 

# yum -y install qpdf qpdf-devel qpdf-libs qpdfview 
# yum -y install tesseract tesseract-osd tesseract-devel  tesseract-langpack-chi_sim


# pip search ocrmypdf
ocrmypdf (8.2.4)  - OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched


# pip install ocrmypdf
Collecting ocrmypdf
  Downloading https://files.pythonhosted.org/packages/4f/84/2e2de3a185c5f8979d88f8c41925005ca7fef7619f812f0cbafb205c2d79/ocrmypdf-8.2.4-py35-none-any.whl (113kB)
     |████████████████████████████████| 122kB 124kB/s 
Collecting chardet<4,>=3.0.4 (from ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
     |████████████████████████████████| 143kB 18kB/s 
Collecting img2pdf<0.4,>=0.3.0 (from ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/e0/c6/7cd14232a1b10bf884c12daf3626afb76c4f60b52ae0eb23ce1519542ae4/img2pdf-0.3.3.tar.gz (80kB)
     |████████████████████████████████| 81kB 30kB/s 
Collecting pdfminer.six==20181108; sys_platform != "darwin" (from ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/8a/fd/6e8746e6965d1a7ea8e97253e3d79e625da5547e8f376f88de5d024bacb9/pdfminer.six-20181108-py2.py3-none-any.whl (5.6MB)
     |████████████████████████████████| 5.6MB 702kB/s 
Collecting ruffus>=2.7.0 (from ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/18/24/05e8fe590d08bd9e6122c6a87425ff741c79edf01d2873f92028e860e547/ruffus-2.8.1.tar.gz (12.2MB)
     |████████████████████████████████| 12.2MB 224kB/s 
Collecting reportlab>=3.3.0 (from ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/a5/d0/e3395ce0fab33245a6597a5db58e99b78e512ae9ae904aa2e7811e332f97/reportlab-3.5.21-cp36-cp36m-manylinux1_x86_64.whl (2.6MB)
     |████████████████████████████████| 2.6MB 704kB/s 
Collecting pikepdf<2,>=1.2.0 (from ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/81/62/f8c14b826cb089b07f7291ae796b24554a9c863a7d79979422c81c2fc854/pikepdf-1.3.0-cp36-cp36m-manylinux1_x86_64.whl (9.6MB)
     |████████████████████████████████| 9.6MB 558kB/s 
Collecting cffi>=1.9.1 (from ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/5f/bf/6aa1925384c23ffeb579e97a5569eb9abce41b6310b329352b8252cee1c3/cffi-1.12.3-cp36-cp36m-manylinux1_x86_64.whl (430kB)
     |████████████████████████████████| 440kB 23.9MB/s 
Collecting Pillow (from img2pdf<0.4,>=0.3.0->ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/d2/c2/f84b1e57416755e967236468dcfb0fad7fd911f707185efc4ba8834a1a94/Pillow-6.0.0-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
     |████████████████████████████████| 2.0MB 1.5MB/s 
Collecting six (from pdfminer.six==20181108; sys_platform != "darwin"->ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting sortedcontainers (from pdfminer.six==20181108; sys_platform != "darwin"->ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/13/f3/cf85f7c3a2dbd1a515d51e1f1676d971abe41bba6f4ab5443240d9a78e5b/sortedcontainers-2.1.0-py2.py3-none-any.whl
Collecting pycryptodome (from pdfminer.six==20181108; sys_platform != "darwin"->ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/06/fc/b09816d7b2d79d6454f75b40def94a89ed785d8d8d07840563f1084c6ecd/pycryptodome-3.8.1-cp36-cp36m-manylinux1_x86_64.whl (9.7MB)
     |████████████████████████████████| 9.7MB 99kB/s 
Collecting lxml>=4.0 (from pikepdf<2,>=1.2.0->ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/35/8a/5e066949f2b40caac32c7b2a77da63ad304b5fbe869036cc3fe4a198f724/lxml-4.3.3-cp36-cp36m-manylinux1_x86_64.whl (5.7MB)
     |████████████████████████████████| 5.7MB 624kB/s 
Collecting pycparser (from cffi>=1.9.1->ocrmypdf)
  Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
     |████████████████████████████████| 163kB 21.2MB/s 
Installing collected packages: chardet, Pillow, img2pdf, six, sortedcontainers, pycryptodome, pdfminer.six, ruffus, reportlab, lxml, pikepdf, pycparser, cffi, ocrmypdf
  Running setup.py install for img2pdf ... done
  Running setup.py install for ruffus ... done
  Running setup.py install for pycparser ... done
Successfully installed Pillow-6.0.0 cffi-1.12.3 chardet-3.0.4 img2pdf-0.3.3 lxml-4.3.3 ocrmypdf-8.2.4 pdfminer.six-20181108 pikepdf-1.3.0 pycparser-2.19 pycryptodome-3.8.1 reportlab-3.5.21 ruffus-2.8.1 six-1.12.0 sortedcontainers-2.1.0

--版本查询:
# ocrmypdf --version
8.2.4


windows下好用的OCR软件:
ABBYY FineReader
http://www.abbyychina.com/

参考:
https://github.com/jbarlow83/OCRmyPDF
https://ocrmypdf.readthedocs.io/en/latest/installation.html
https://github.com/tesseract-ocr/tesseract

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值