OSError: [Errno 2] No such file or directory using pytesser

前端 未结 7 2000
鱼传尺愫
鱼传尺愫 2020-12-16 05:50

This is my problem, I want to use pytesser to get a picture\'s contents. My operating system is Mac OS 10.11, and I have already installed PIL, pytesser, tesseract-ocr engin

相关标签:
7条回答
  • 2020-12-16 06:15

    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

    0 讨论(0)
提交回复
热议问题