PIL只能使用在Python2.x版本中,还没有支持Python3.x的版本

Python3.x 中安装不了PIL
由于PIL不支持Python3.x, 所以就有了pillow库,可以通过

pip3 install pillow

安装好pillow库之后,就可以跟安装好PIL库一样,导入PIL

from PIL import Image

测试代码:

import pytesseract
from PIL import Image

image = Image.open("./pip_test.png")
text = pytesseract.image_to_string(image)
print(text)

相关文章: