如何在 Databricks 上安装 Tesseract OCR

Mic*_*tos 5 tesseract python-tesseract databricks azure-databricks

我正在尝试在 databrick python 笔记本上运行以下脚本:

pip install presidio-image-redactor
pip install pytesseract
python -m spacy download en_core_web_lg

from PIL import Image
from presidio_image_redactor import ImageRedactorEngine
import pytesseract

image = Image.open("images/ImageData.PNG")

engine = ImageRedactorEngine()

redacted_image = engine.redact(image, (255, 192, 203))
Run Code Online (Sandbox Code Playgroud)

运行最后一行后,我收到以下错误:

TesseractNotFoundError:tesseract 未安装或不在您的路径中。

我错过了什么吗?

Ale*_*Ott 6

您可以%sh在单独的单元中使用在驱动程序节点上执行 shell 命令。要安装 tesseract,你可以这样做:

%sh apt-get -f -y install tesseract-ocr 
Run Code Online (Sandbox Code Playgroud)

如果需要将其安装到集群的所有节点,则需要使用具有相同命令的cluster init 脚本%sh(不带)