用pytesseract 识别图片的中文 ,出现报错 has no attribute 'Image',找了好多资料还是没有解决

0
需要的库和字体 PIL\pytesseract \ traineddata  都已经装好了,代码:

from PIL import Image 
import pytesseract
image = Image.open("1.jpg") 
#image.show() #打开图片1.jpg 
text = pytesseract.image_to_string(image,lang='chi_sim') #使用简体中文解析图片 
print(text)
 
老是报错:
Traceback (most recent call last):
  File "D:/Chad/测试/Air2.py", line 6, in <module>
    text = pytesseract.image_to_string(image,lang='chi_sim') #使用简体中文解析图片
  File "C:\Program Files\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 117, in image_to_string
    image = prepare(image)
  File "C:\Program Files\Anaconda3\lib\site-packages\pytesseract\pytesseract.py", line 90, in prepare
    if isinstance(image, Image.Image):
AttributeError: module 'Image' has no attribute 'Image'
jiexi.jpg
已邀请:

要回复问题请先登录注册