小编Cha*_*e22的帖子

没有这样的文件或目录: 'tesseract': 'tesseract' 即使在 pytesseract.py 中指定了在哪里找到 tesseract

所以我一直在研究这个问题一段时间,而其他人也有类似的问题,但对我没有任何帮助:

我正在尝试将 pytesseract 用于一个项目,并将其安装在 User/Environments/testEnv/lib/python3.6/site-packages/pytesseract/

我在下面安装了tesseract usr/local/bin

我已经进入Users/User/Environments/testEnv/lib/python3.6/site-packages/pytesseract/pytesseract.py并改变tesseract_cmd = 'tesseract'tesseract_cmd = '/usr/local/bin/tesseract'如下建议:OSERROR:[错误2]没有这样的文件或目录使用pytesser

这没有用。我试图运行这个:

try:
    import Image
except ImportError:
    from PIL import Image
import pytesseract

img = Image.open('screenshot.png')
img.load()
i = pytesseract.image_to_string(img)
print (i)
Run Code Online (Sandbox Code Playgroud)

我明白了:

Traceback (most recent call last):
  File "/Users/User/Environments/testEnv/testTess.py", line 26, in <module>
    i = pytesseract.image_to_string(img)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytesseract/pytesseract.py", line 122, in image_to_string
    config=config)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pytesseract/pytesseract.py", line 46, in run_tesseract
    proc = subprocess.Popen(command, stderr=subprocess.PIPE)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session) …
Run Code Online (Sandbox Code Playgroud)

python tesseract python-3.x python-tesseract

6
推荐指数
1
解决办法
5110
查看次数

标签 统计

python ×1

python-3.x ×1

python-tesseract ×1

tesseract ×1