在写爬虫的时候总是遇到一些以图片的形式展示的信息,因此要怎么解析图片上的信息呢?在Google上查了一下,需要安装pytesseract和pillow(我用的python3.7)和Tesseract-OCR
- 安装pytesseract
pip insatll pytesseractpip insatll pytesseract - 安装pillow
- 安装Tesseract-OCR(https://github.com/tesseract-ocr/tesseract)
- 安装完后将Tesseract-OCR的安装路径添加到环境变量中PATH和Path中,都要添加。例如:
- 在python的安装路径下的修改安装的pytesseract库里面的pytesseract.py,将默认的改成Tesseract-OCR的安装路径
- 配置完了开始撸代码吧