0
Traceback (most recent call last):
  File "C:\Python27\Stuff\imagetotext.py", line 9, in <module>
    i = pytesseract.image_to_string(img)
  File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 143, in
image_to_string
    if len(image.split()) == 4:
AttributeError: 'PixelAccess' object has no attribute 'split'

所以,我真的不知道该怎么办。https://gyazo.com/63c6439285d629c72e9076c1b4a29a42是 test.png。我已经尝试了很多。

try:
    import Image
except ImportError:
    from PIL import Image
import pytesseract

img = Image.open('test.bmp').load()
#img.load()
i = pytesseract.image_to_string(img)
print i

我读过它可能是 PIL 的一个错误,但我只是不知道。

4

1 回答 1

0
try:
    import Image
except ImportError:
    from PIL import Image
import pytesseract

img = Image.open('test.bmp')
img.load()
i = pytesseract.image_to_string(img)
print i
于 2016-07-15T04:19:36.057 回答