Mac에서 image_to_string이 작동하지 않습니다
-
21-12-2019 - |
문제
이 예제를 사용하려고합니다 ( 링크 )Mac Maverick.
>>> from pytesser import *
>>> im = Image.open('phototest.tif')
>>> text = image_to_string(im)
.
그러나 마지막 줄 에서이 오류 메시지가 나타납니다.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pytesser.py", line 31, in image_to_string
call_tesseract(scratch_image_name, scratch_text_name_root)
File "pytesser.py", line 21, in call_tesseract
proc = subprocess.Popen(args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
.
하지만, 나는 무엇을 해야하는지 이해하지 못합니다.파일 phototest는 스크립트를 실행중인 폴더에 있습니다.이 문제를 해결하는 방법?
업데이트 :
내가 시도 할 때
brew install tesseract
.
이 오류가 발생했습니다 :
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: You must `brew link libtiff libpng jpeg' before tesseract can be installed
. 해결책
나는 실제로 당신과 같은 오류가있었습니다.이 오류는 내가이 게시물을 발견했는지입니다. 나는 또한 나에게 그것을 주었 기 때문에 내 문제에 대한 해결책이 있습니다!
나는보고 있었다 :
ryan.davis$ python tesseract.py
Traceback (most recent call last):
File "tesseract.py", line 52, in <module>
print (image_to_string(big))
File "/usr/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 161, in image_to_string
config=config)
File "/usr/local/lib/python2.7/site-packages/pytesseract/pytesseract.py", line 94, in run_tesseract
stderr=subprocess.PIPE)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
.
이 문제를 해결하기 위해 내가해야 할 일을 알고 싶습니까? 정확히 시도한 것 : brew install tesseract
Tesseract Python 라이브러리를 설치했지만 시스템 수준에 설치하지 않았습니다. 그래서 그것은 내 문제를 해결합니다. 당신은 어떨까요?
나는 당신이 이것으로 산만 해졌을지도 모른다 :
경고 : MacPorts 또는 Fink가 설치된 것으로 나타납니다. 소프트웨어 다른 패키지 관리자와 함께 설치하면 알려진 문제가 발생합니다 홈 덤프. 수식이 빌드되지 않으면 MacPorts / Fink를 제거하고 시도하십시오. 다시.
답변이 이미 양조 응답에 제공된 것을 알지 못했습니다 :
Tesseract가 될 수 있기 전에 Libtiff Libpng JPEG를 링크로 링크해야합니다. 설치되었습니다.
그래서 :
brew link libtiff
brew link libpng
brew link jpeg
.
그런 다음 :
brew install tesseract
.
마지막으로 :
:)
. 제휴하지 않습니다 StackOverflow