java 无法加载库“tesseract”:libtesseract.so:无法打开共享对象文件:没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15307168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 19:11:01  来源:igfitidea点击:

Unable to load library 'tesseract': libtesseract.so: cannot open shared object file: No such file or directory

javacentostesseractleptonica

提问by Omnipresent

I've had tesseract and Tess4Jrunning on my MBP for a while now. Today I started to migrate my app to the server and started installing everything on the server. Prior to running Tess4J in tomcat I tried to run a simple java program to make sure everything is fine and dandy. It's not...

我已经有一段时间在我的 MBP 上运行tesseract 和Tess4J。今天我开始将我的应用程序迁移到服务器并开始在服务器上安装所有内容。在 tomcat 中运行 Tess4J 之前,我尝试运行一个简单的 java 程序以确保一切正常。不是...

  • I'm on a centOS 64bit server
  • I've installed tesseract and its working fine - tesseract myimage.jpg mytextproduces data
  • 我在centOS 64位服务器上
  • 我已经安装了 tesseract 并且它工作正常 -tesseract myimage.jpg mytext产生数据

However, running my simple class that useses Tess4j produces this error:

但是,运行我使用 Tess4j 的简单类会产生此错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': libtesseract.so: cannot open shared object file: No such file or directory

线程“main”中的异常java.lang.UnsatisfiedLinkError:无法加载库“tesseract”:libtesseract.so:无法打开共享对象文件:没有这样的文件或目录

What I've done so far

到目前为止我所做的

  • I've ran sudo ldconfigafter installing tesseract
  • I've search for libtesseract.so and its found in /usr/local/lib/libtesseract.so
  • sudo ldconfig安装tesseract后我跑了
  • 我搜索了 libtesseract.so 并在 /usr/local/lib/libtesseract.so

Folder on server contains these files:

服务器上的文件夹包含以下文件:

myimge.png  
ghost4j-0.3.1.jar  
jai_imageio.jar  
jna.jar  
maslab.jar  
pngj.jar  
tess4j.jar  
TesseractExample.class  
TesseractExample.java

tesseract -v produces:

tesseract -v 产生:

tesseract -v
tesseract 3.02.02
 leptonica-1.69
  libjpeg 6b : libpng 1.2.49 : libtiff 3.9.4 : zlib 1.2.3

Question

问题

How can I make Tess4J aware that libtesseract.so does exist?enter code here

如何让 Tess4J 意识到 libtesseract.so 确实存在?enter code here

回答by youdsmedia

I had this problem too.

我也有这个问题。

Did you run the following after installing tesseract:

安装tesseract后是否运行了以下命令:

sudo ldconfig

That fixed it for me.

那为我修好了。

回答by Marcos Pirmez

You must set LD_LIBRARY_PATH environment variable to the path where libtesseract.so is.

您必须将 LD_LIBRARY_PATH 环境变量设置为 libtesseract.so 所在的路径。

export LD_LIBRARY_PATH=/usr/local/lib

回答by Alessandro Leite

It is necessary to define the variable jna.platform.library.path. For instance:

有必要定义变量jna.platform.library.path。例如:

-Djna.platform.library.path=/usr/local/lib/

-Djna.platform.library.path=/usr/local/lib/

回答by Jean Waghetti

Maybe it is a 32 bit library .soinstalled.

可能是.so安装了 32 位库。