爬虫趣事

1. 验证码用到tesseract,但没有python3.7版本的tesserocr,无奈之下找到pytesseract,使用过程出现波折,参考博客https://segmentfault.com/a/1190000014091417里面的方法,环境变量也修改了,还是报错,最后发现是config没整好,在代码中添加变量参数如下,结果就识别了,再看看pytesseract的代码,修改了下博客中提到的这两个代码,就可以不用每次都再重新修改代码了,开森~

import pytesseract
from PIL import Image

pytesseract.pytesseract.tesseract_cmd = 'D:/xxx/Tesseract-OCR/tesseract.exe'
tessdata_dir_config = '--tessdata-dir "D:/xxx/Tesseract-OCR/tessdata"'

image = Image.open("code.png")
code = pytesseract.image_to_string(image, config=tessdata_dir_config)
print(code)

2. flask 一直出错,总是出现warning:Do not use the development server in a production environment.
   Use a production WSGI server instead. 刚刚看到一个网友说把计算机名改一下就好了,就好了,好了,了

原文地址:https://www.cnblogs.com/wangjinliang1991/p/9898875.html