Cannot import name '_imaging' from 'PIL'

喜夏-厌秋 提交于 2021-02-05 06:09:39

问题


I'm trying to run this code:

import pyautogui
import time
from PIL import _imaging
from PIL import Image
import pytesseract

time.sleep(5)
captura = pyautogui.screenshot()
codigo = captura.crop((872, 292, 983, 337))
codigo.save(r'C:\autobot_wwe_supercard\imagenes\codigo.png')
time.sleep(2)
pytesseract.pytesseract.tesseract_cmd = r'C:\Program     
Files\Tesseract-OCR\tesseract'
print(pytesseract.image_to_string(r'D:\codigo.png'))

And this error pops up: ImportError: cannot import name 'imaging' from 'PIL' (C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\PIL_init.py)

I installed pillow in console with pip install pillow

I installed pytesseract in console with pip install pytesseract


回答1:


It appears as if a lot of PIL ImportErrors can simply be fixed by uninstalling and reinstalling Pillow again according to this source and your specific problem can be found here.

Try these three commands:

pip uninstall PIL
pip uninstall Pillow
pip install Pillow


来源:https://stackoverflow.com/questions/64998199/cannot-import-name-imaging-from-pil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!