0

我正在将 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

4

1 回答 1

0

我使用 pytesseract 遇到了同样的错误,我想这非常相似;对我有用的是安装 Pillow (一个(最近维护的?)PIL 的分支)。您可能需要更改 to 的任何import Image实例from PIL import Image

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

于 2015-07-21T21:56:23.920 回答