sml2h3 / ddddocr

带带弟弟 通用验证码识别OCR pypi版
https://ddddocr.com
MIT License
8.96k stars 1.64k forks source link

出现:AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #139

Closed zhonghai9967 closed 8 months ago

zhonghai9967 commented 10 months ago

在pillow的10.0.0版本中,ANTIALIAS方法被删除了,改成了LANCZOS.使用新的方法即可: 解决办法:(推荐方案二) 方案一,修改ddddocr的init.py文件,将其中的ANTIALIAS替换为新方法:共4处

image = image.resize((int(image.size[0] * (64 / image.size[1])), 64), Image.ANTIALIAS).convert('L')

改ANTIALIAS为LANCZOS

image = image.resize((int(image.size[0] * (64 / image.size[1])), 64), Image.LANCZOS).convert('L')

方案二,降级Pillow的版本,比如使用9.5.0版本(先卸载,再重新安装) pip uninstall -y Pillow pip install Pillow==9.5.0

zhonghai9967 commented 10 months ago

很可惜,最新的1.4.8也存在这个问题,也仍然不支持python3.11

haowuge commented 9 months ago

这个有进度嘛

RefractionPrism commented 7 months ago

感谢 成功解决