tesseract install mac os

2019-06-22 08:06发布

I am trying to install tesseract on my mac using homeBrew. When I try installing, everything seems to be good but I get the following error/message:

Warning: Could not link leptonica. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link leptonica'

When I try running a tesseract function, I get the following error:

Tesseract Open Source OCR Engine v3.02.02 with Leptonica
Error in pixReadStreamPng: function not present
Error in pixReadStream: png: no pix returned
Error in pixRead: pix not read
Unsupported image type.

I have image magick installed and the command I used to install tesseract was:

brew install tesseract

Can anyone please tell me what I can do to get tesseract working? Thank you!

EDIT When I run brew link leptonica, I get the following error:

Could not symlink file: /usr/local/Cellar/leptonica/1.69/bin/yuvtest
Target /usr/local/bin/yuvtest already exists. You may need to delete it.

4条回答
孤傲高冷的网名
2楼-- · 2019-06-22 08:33

After installing / removing and re-installing tesseract i found the solution for the same problem you have. On your terminal logs, while installing tesseract, you will see:

Error: The brew link step did not complete successfully

The formula built, but is not symlinked into /usr/local Could not symlink bin/convertfilestopdf Target /usr/local/bin/convertfilestopdf already exists.
You may want to remove it: rm '/usr/local/bin/convertfilestopdf'
To force the link and overwrite all conflicting files: brew link --overwrite leptonica

To list all files that would be deleted: brew link --overwrite --dry-run leptonica

What i did was running: brew link --overwrite leptonica

"Linking /usr/local/Cellar/leptonica/1.71_1... 45 symlinks created"

Everything should work perfectly.

Hope this can be a help for you

查看更多
走好不送
3楼-- · 2019-06-22 08:33

It sounds a bit silly, but have you tried deleting yuvtest? I just tried it myself - the file is automatically generated by brew link leptonica. As for why it isn't working, is it possible you had some version of leptonica/tesseract installed previously? Another reasonable guess at a fix would be

brew uninstall tesseract; brew install tesseract

So far as I know, image magick being installed shouldn't matter for tesseract. They don't have anything in common.

查看更多
我命由我不由天
4楼-- · 2019-06-22 08:33

Now, as of January 2019, Tesseract installs fine via homebrew, as long as you have xquartz installed first, brew cask install xquartz. Then you can do the following: brew install tesseract --with-all-languages --with-serial-num-pack --with-training-tools

查看更多
The star\"
5楼-- · 2019-06-22 08:59

Tesseract is now dependent on Leptonica being installed.

The error messages you are seeing relate to these files:

Leptonica is configured to handle image I/O using these external libraries: libjpeg, libtiff, libpng, libz, libgif, libwebp.

These libraries are easy to obtain. For example, using the debian package manager: sudo apt-get install where = {libpng12-dev, libjpeg62-dev, libtiff4-dev}.

Source: Leptonica unofficial documentation

I found that homebrew would install some but not all of the libraries.

查看更多
登录 后发表回答