Skip to content

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #70

Closed
@paynepang

Description

查看一下pillow的版本:10.0.0

通过在pillow官方网站,release notes中找到了问题:
image
原来是在pillow的10.0.0版本中,ANTIALIAS方法被删除了,改为10.0版本许可的参数即可。

解决办法:(推荐方案二)

方案一,修改ddddocr的_init_.py文件,将其中的ANTIALIAS替换为新方法:

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

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

方案二,降级Pillow的版本,比如使用9.5.0版本

先卸载,再重新安装

pip uninstall -y Pillowpip install Pillow==9.5.0
两种方案都亲测可用

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions