pytesseract não funciona [fechado]

-1
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from PIL import Image
>>> import pytesseract
>>> i=Image.open("C:\Users\dharaneeshvrd\Desktop\img.jpg

SyntaxError: EOL while scanning string literal

>>> i=Image.open("C:\Users\dharaneeshvrd\Desktop\img.jpg")
>>> print pytesseract.image_to_string(i)

Traceback (most recent call last): File "", line 1, in print pytesseract.image_to_string(i) File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 161, in image_to_string config=config) File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 94, in run_tesseract stderr=subprocess.PIPE) File "C:\Python27\lib\subprocess.py", line 390, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 640, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified

>

  

O que eu fiz de errado aqui? Eu instalei o pytesseract usando pip como

pip install pytesseract

e travesseiro como

pip install pillow
    
por Dharaneesh Vrd 13.03.2017 / 11:15

1 resposta

2

Conforme especificado no erro:

The system cannot find the file specified

O nome do arquivo - C: \ Usuários \ dharaneeshvrd \ Desktop \ img.jpg - está incorreto (ou não existe).

Supondo que você esteja executando no Ubuntu, o formato do nome do arquivo deve ser diferente.

Eu sugeriria primeiro identificar o arquivo na sua unidade e, em segundo lugar, emitir:

ls -lsa /full/path/name

para certificar-se de que você escreveu o caminho corretamente, e depois usá-lo no script python

    
por Yaron 13.03.2017 / 11:20