2016-07-15 38 views
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。我尝试了很多。Python 2.7 PyTesseract AttributeError:'PixelAccess'对象没有'split'属性

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的错误,但我只是不知道。

回答

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 
+0

WindowsError:[错误2]系统找不到指定的文件 –

+0

它位于同一个文件夹中。 –

+0

我想你没有安装tesseract。 – RAVI

相关问题