AttributeError: module 'PIL.Image' has no attribute 'Resampling':
该问题出现在利用easyocr的时候,准备进行图片中文字的识别。
import easyocr
reader = easyocr.Reader(['ch_tra','en'])
result = reader.readtext(r'D:\aaa\try.png')
print(result)
发现出现该报错,一开始在网上找的解决办法针对到具体的包的内容进行的引用,
from PIL import Image
try:
from PIL import ImageFilter, ImageOps, ImageEnhance, __version__, UnidentifiedImageError
from PIL.Image import BICUBIC, LANCZOS, NEAREST, BILINEAR, BOX, HAMMING
except ImportError:
import ImageFilter, ImageOps, ImageEnhance, __version__, UnidentifiedImageError
from PIL.Image import BICUBIC, LANCZOS, NEAREST, BILINEAR, BOX, HAMMING
from PIL import Image
Image.Resampling = None
但是发现还是对于NoneType进行报错,之前进行了pillow包的更新,不知道是什么原因还是没有找到。再次尝试对于pillow进行更新
出现该报错,完善更新命令,添加--user,更新成功!
pip install --user --upgrade pillow -i https://pypi.tuna.tsinghua.edu.cn/simple