verify

来源:互联网 发布:rtmp嗅探器软件 编辑:程序博客网 时间:2024/04/28 07:05
python+selenium处理验证码
1.Win7 64位下Python安装PIL图像处理库,首先,在PIL非官方的64位库下载非官方64位pillow,
注意下载符合自己python的pillow
http://blog.csdn.net/u012428169/article/details/70210017
pip install 下载文件的路径
2.安装pytesseract pip install pytesseract
3.安装tesseract-ocr 


1遇到问题:
1.OSError: cannot write mode RGBA as JPEG
解决:i= i.convert('RGB')
2.pytesseract.image_to_string()  系统找不到指定文件
解决:
\python35\Lib\site-packages\pytesseract下打开文件 pytesseract.py,找到如下代码,将tesseract_cmd的值修改为全路径,在此使用就不会报错了。
# CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY
# tesseract_cmd = 'tesseract'

tesseract_cmd = 'C:/Program Files (x86)/Tesseract-OCR/tesseract.exe'

3.登录后窗口最小化了

解决:driver.switch_to.default_content()