I found a way for python.
First install tesseract like this:
sudo apt-get install tesseract
Then you can use it as below:
tesseract example.jpg out
install pytesseract using pip:
pip install pytesseract
install pillow if not done yet:
pip install pillow
install tesseract-ocr:
sudo apt-get install tesseract-ocr
Then use it in your python code like this:
`from PIL import Image
import pytesseract
# path to your file
im = Image.open('test.png')
print pytesseract.image_to_string(im)`