Python 2.7.9中的Pytesser - 打印image_to_string(图像)错误

时间:2015-03-12 04:44:42

标签: python python-2.7 ocr pytesser

我使用Pytesser进行python OCR。我已经安装了PIL和Pytesser 我已经运行了这些代码:

from pytesser import *
image = Image.open('C:\\Users\\panzer400\\Desktop\\fnord.tif')
print image_to_string(image)

然后出现此错误

    Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    print image_to_string(image)
  File "C:\Python27\lib\pytesser\__init__.py", line 30, in image_to_string
    util.image_to_scratch(im, scratch_image_name)
  File "C:\Python27\lib\pytesser\util.py", line 7, in image_to_scratch
    im.save(scratch_image_name, dpi=(200,200))
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1406, in save
    self.load()
  File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 164, in load
    self.load_prepare()
  File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 231, in load_prepare
    self.im = Image.core.new(self.mode, self.size)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 37, in __getattr__
    raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed

这意味着什么?我做错了什么? 我使用的是Windows 8 64位和Python 2.7.9

1 个答案:

答案 0 :(得分:0)

我使用pytesseract得到同样的错误,我想这是非常相似的;对我有用的是安装Pillow(一个(最近维护的?)PIL的分支)。您可能需要将$('#example').dataTable( { "columnDefs": [ { "targets": 'no-sort', "orderable": false, } ]} ); 的任何实例更改为import Image

(请注意,Pillow仍然作为PIL导入)