Oserror: [errno 2] No Such File Or Directory Using Pytesser
Solution 1:
Luckily, I solved this one.
At first, I run the command
pip install pytesseract
to install the package.
But I get the error message of 'No such file or directory using pytesser'.
Then I read this link: image_to_string doesn't work in Mac So, just run the following script:
brew link libtiff
brew link libpng
brew link jpeg
brew install tesseract
Worked for me ~
Solution 2:
Open file pytesseract.py.
Mine is in /Users/yourUser/.virtualenvs/cv/lib/python2.7/site-packages/pytesseract/pytesseract.py
Change tesseract_cmd = 'tesseract'
to tesseract_cmd = '/usr/local/bin/tesseract'
Solution 3:
I had the same problem, but i managed to convert image to string.
using apt-get
should do the trick:
sudo apt-get install tesseract-ocr
and if you can't use it in a python script just do this:
from os import systemsystem("tesseract -l eng /image.png text.txt")
Solution 4:
You're getting exception because subprocess isn't able to find the binaries (tesser executable).
The installation is a 3 step process:
1.Download/Install system level libs/binaries:
For various OS here's the help. For MacOS you can directly install it using brew.
Install Google Tesseract OCR (additional info how to install the engine on Linux, Mac OSX and Windows). You must be able to invoke the tesseract command as tesseract. If this isn’t the case, for example because tesseract isn’t in your PATH, you will have to change the “tesseract_cmd” variable at the top of tesseract.py. Under Debian/Ubuntu you can use the package tesseract-ocr. For Mac OS users. please install homebrew package tesseract.
Bash script for installing tesseract-ocr on RHEL/CentOS 7
Using
yum
- from SO answer -/usr/bin/yum --enablerepo epel-testing install tesseract.x86_64
- A manual installation guide for CentOS - SO Answer.
2.Install Python package
pip install pytesseract
3.Finally, you need to have tesseract binary in you PATH.
Or, you can set it at run-time:
import pytesseract
pytesseract.pytesseract.tesseract_cmd = '<path-to-tesseract-bin>'
The default path 'd be /usr/local/bin/tesseract
Solution 5:
You need to install tesseract-ocr:
sudo apt-get install tesseract-ocr
And in the script
from PIL import Image
import os
import pytesseract
text = pytesseract.image_to_string(Image.open(os.path.abspath('test.png')))
Post a Comment for "Oserror: [errno 2] No Such File Or Directory Using Pytesser"