我正在尝试使用pytesseract库,但是无论使用多少解决方案,我都遇到相同的问题。如果有帮助,我目前正在使用Mac(Mojave)。这是我得到的错误:
回溯(最近通话最近): 文字= pytesseract.image_to_string(Image.open('temp.TIFF')) 文件“ /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytesseract/pytesseract.py”,行343,在image_to_string中 } output_type 文件“ /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytesseract/pytesseract.py”,第342行,在 输出:STRING:lambda:run_and_get_output(* args), 在run_and_get_output中的文件“ /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytesseract/pytesseract.py”,第251行 run_tesseract(** kwargs) 在run_tesseract中的文件“ /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytesseract/pytesseract.py”第227行 引发TesseractError(proc.returncode,get_errors(error_string)) pytesseract.pytesseract.TesseractError:(2,'用法:python pytesseract.py [-l lang] input_file')
这是引起我麻烦的线。
text = pytesseract.image_to_string(Image.open('temp.png'))