先安装腾讯云笔记里的下载
腾讯云笔记 : https://note.youdao.com/web/#/file/recent/note/086A1E35EC9D4D9594CFC2E61D8024C1/
import pytesseract
from PIL import Image
image = Image.open('code.jpg')
# image = Image.open('code3.jpg')
#彩色图编程灰度图
image = image.convert('L')
threshold = 169
table = []
for i in range(256):
if i<threshold:
table.append(0)
else:
table.append(1)
image = image.point(table,'1')
# image.show()
text = pytesseract.image_to_string(image)
print(text)
如果没出结果
按两次shift跳转到pytesseract.py中
修改路径