pip,PyCharm安装tesserocr报错解决办法

在爬取时可能会遇到验证码验证,可以使用tesserocr库识别验证码。但是在安装tesserocr时出现了各种报错。如pip安装

pip install tesserocr 或者是 pip install tesserocr

都会出现报错,报错内容很多,有python setup.py egg_info did not run successfully.

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed等很多报错提示。

 

即使是根据其他博主的文章安装了tesseract,和对应的whl文件,也照样报错。使用pycharm直接搜索安装tesserocr安装包也报错了,点开安装失败的详细信息和pip安装失败的报错差不多。

 

 我也查找了大量文章寻找解决问题后面在pycharm再次尝试安装tesserocr时发现了pytesseract安装包,查询后发现pytesseract也可以识别验证码,是chrome提供的一个安装包。我尝试使用pytsseract

import pytesseract
from PIL import Image

image = Image.open('D:\image.png.png')
print(pytesseract.image_to_string(image))

 识别的图片

 结果如下


可看到识别成功,如果感觉安装tesserocr让自己血压上升不如直接

pip install pytesseract  或者用pycharm直接搜索pytesseract安装,两秒搞定。

pycharm安装pytesseract——>文件——->设置

 

 

想要了解更多有关pytesseract

Pytesseract ·PyPIicon-default.png?t=M1L8https://pypi.org/project/pytesseract/

来源:亖夕

物联沃分享整理
物联沃-IOTWORD物联网 » pip,PyCharm安装tesserocr报错解决办法

发表评论