【发布时间】:2016-05-01 03:44:41
【问题描述】:
我正在尝试在我的 Mac 上运行以下代码。
import Image
enter code here`import pytesseract
im = Image.open('test.png')
print pytesseract.image_to_string(im)
从这里提问:pytesseract-no such file or directory error 我需要安装 tesseract-ocr
但是当我尝试 pip install tesseract-ocr 时出现以下错误:
creating build/temp.macosx-10.5-x86_64-2.7
gcc -fno-strict-aliasing -I//anaconda/include -arch x86_64 -DNDEBUG -g
-fwrapv -O3 -Wall -Wstrict-prototypes -I//anaconda/include/python2.7 -c
tesseract_ocr.cpp -o build/temp.macosx-10.5-x86_64-2.7/tesseract_ocr.o
tesseract_ocr.cpp:264:10:
fatal error: 'leptonica/allheaders.h' file not found #include "leptonica/allheaders.h"
^
1 error generated.
error: command 'gcc' failed with exit status 1
我不知道该怎么办。
【问题讨论】:
-
你需要安装一个 C 库,这里应该可以使用 leptonica.org/download.html ;如果您使用的是 brew,
brew install leptonica可能会有所帮助。 -
我试过
pip install leptonica但收到另一个错误Could not find a version that satisfies the requirement leptonica (from versions: ) No matching distribution found for leptonica -
如果
pip install leptonica是可能的,pip install tesseract-ocr会自动执行。
标签: python tesseract python-tesseract pytesser