ubuntu 下安装 PyTesser 进行OCR识别

本文介绍了在Ubuntu操作系统中安装PyTesser进行OCR识别的步骤,首先需要安装依赖库leptonica,接着安装Tesseract及其语言包,最后安装PyTesser,以便在32位和64位系统上使用Python进行OCR处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

pytesser 调用了 tesseract,因此需要安装 tesseract,安装 tesseract 需要安装 leptonica


安装列表:

leptonica

tesseract  以及  tesseract 语言包

pytesser


错误:
IOError: decoder zip not available

方法一:有可能不成功

Then, on 32-bit Ubuntu, you should run:

sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/

Otherwise, on 64-bit Ubuntu, you should run:

sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/

方法二:
修改 setup.py 搜索 /usr/lib/添加 
/usr/lib/x86_64-linux-gnu/


参考:
# rm -rf /usr/local/lib/python2.7/site-packages/PIL* 
# rm -rf /src/Imaging-1.1.7 
# cd /src 
# tar -xvzf Imaging-1.1.7.tar.gz 
# cd Imaging-1.1.7 
# python2.7 setup.py build_ext -i 
# python2.7 selftest.py 
# python2.7 
 >>> import _imaging 
 >>> [(k, v) for k, v in vars(_imaging).items() if k[0] == 'z']     
#Confirmed that the zip decoder libs were there 
# python2.7 setup.py install 

In trying to retrace my steps to figure out where I went wrong, I think 
I used the "simple" install method listed at the top of the README (0. 
If you're in a hurry...) first. All the supporting libraries were in 
place in their standard locations so I figured I was safe for the simple 
install. Note to self...)  ;) 

Anyway, i remember that this failed to find 3/5 libraries. It appears 
that the build process does not check /usr/lib64 by default (which is 
one of the default locations for libraries on a Linux x64 system. So, I 
updated setup.py with the necessary paths to the libs. 

I believe I then tried a "setup.py clean" command to reset the build 
directories... Something along those lines. In any case, it appears I 
did not get the original failed install out of the system when I thought 
I had and that is what was tripping me up all along. 

IOError: [Errno 2] No such file or directory: 'tesseract.log'
安装 语言包 English language data for Tesseract (3.00 and up)

安装教程:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值