2016-07-15 21 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

関連する問題