簡體   English   中英

錯誤:ModuleNotFoundError:沒有名為“圖像”的模塊

[英]Error:ModuleNotFoundError: No module named 'Image'

我收到以下錯誤:

ModuleNotFoundError:沒有名為“圖像”的模塊

在運行以下OCR腳本時:

import Image
from tesseract import image_to_string


print(image_to_string(Image.open('marlboro.png'), lang='eng'))

我正在通過Anaconda使用Spider並安裝了Pillow。

看一下docs ,您可以在其中看到一些基本示例。 簡而言之:您需要指定要從PIL導入Image

from PIL import Image

您應該安裝pytesseract use pip(另請參見指南 ):

pip install pytesseract

接着:

from PIL import Image
from pytesseract import image_to_string

print(image_to_string(Image.open('marlboro.png'), lang='eng'))

或使用python跨平台模塊tesseract

pip install tesseract

並按照您的問題使用它:

from PIL import Image
from tesseract import image_to_string

print(image_to_string(Image.open('marlboro.png'), lang='eng'))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM