在Ubuntu上安装Python-tesseract

时间:2016-03-19 21:14:00

标签: python ocr tesseract python-tesseract

我正在尝试从Ubuntu 15.04上的deb文件安装python-tesseract 0.9-0.5,但它会产生一些错误。 这就是我的工作:

1-我在终端上打开文件的路径并写

sudo dpkg -i python-tesseract_0.9-0.5ubuntu2_i386.deb

2-此后,控制台显示几个错误:

Selecting previously unselected package python-tesseract.
(Reading database ... 349994 files and directories currently installed.)

Preparing to unpack python-tesseract_0.9-0.5ubuntu2_i386.deb ...

Unpacking python-tesseract (0.9-0.5ubuntu2) ...
dpkg: dependency problems prevent configuration of python-tesseract:
 python-tesseract depends on python (<< 2.8).
 python-tesseract depends on python (>= 2.7~).
 python-tesseract depends on liblept4.
 python-tesseract depends on libopencv-core2.4; however:
  Package libopencv-core2.4:i386 is not installed.
 python-tesseract depends on libtesseract3; however:

dpkg: error processing package python-tesseract (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:    
 python-tesseract

3-只是为了检查,我打开安装文件并解压缩tesseract.py类,并在python中单独使用。 我这样开了:

python tesseract.py 

,但我明白了:

Traceback (most recent call last):
  File "tesseract.py", line 28, in <module>
    _tesseract = swig_import_helper()
  File "tesseract.py", line 20, in swig_import_helper
    import _tesseract
ImportError: No module named _tesseract

问题是我想在python上使用tesseract函数来进行光学字符识别应用程序,我已经明白最好的包装器是python-tesseract(我认为与pytesseract不同)。

我的问题是:如何在Ubuntu 15.04上安装python-tesseract?非常感谢

4 个答案:

答案 0 :(得分:0)

当我试图让python使用Tesseract时,我发现这个tutorial非常有用。 但后来我发现这对我的需求来说太简单了,所以我需要找到另一个解决方案。

我希望这能帮到你!

答案 1 :(得分:0)

首先安装gdebi-core,然后安装.deb软件包,以便gdebi为我安装依赖项。我使用的是Ubuntu 14.04。

yourCell.selectionStyle = .None

答案 2 :(得分:0)

Use this link for installation

一旦您这样做, 这是代码

from PIL import Image
img="pathToYourImage/img.jpeg"
text = pytesseract.image_to_string(Image.open(img))
print(text)

答案 3 :(得分:-2)

 sudo apt-get install tesseract-ocr

**After Entering this command in terminal it will install tesseract **