Linux报错:Ubuntu运行程序报错找不到libssl.so.1.1或libcrypto.so.1.1解决方法

发布于:2024-04-25 ⋅ 阅读:(31) ⋅ 点赞:(0)

Ubuntu运行程序报错找不到libssl.so.1.1的解决方法

error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

背景

在Ubuntu22系统上运行脚本文件,弹出提示:

在这里插入图片描述

error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

提示有库没装,上网查了一大圈,答案比较统一,都是让安装或者重新安装库和相关依赖,但尝试了并没有解决问题,换Ubuntu系统版本也不行。

并且用find命令寻找libssl库是已经安装了的:

在这里插入图片描述

如果你尝试了别的方法,并且已经确认了安装了库和相关依赖,但没能解决问题,可以试一下本文提供的方法:
在x86_64架构下, 在 /usr/lib/x86_64-linux-gnu 文件夹下默认存放的是Gnu C/C++ 编译器的系统库,我们需要把找不到的库文件拷贝到这个目录下:

1、用find命令确定库所在位置
find / -name libssl.so.1.1
/snap/core20/1974/usr/lib/x86_64-linux-gnu/libssl.so.1.1

2、确定x86_64-linux-gnu所在的位置
root@skps:/lib/x86_64-linux-gnu# pwd
/lib/x86_64-linux-gnu

3、进入相对路径
cd /snap/core20/1974/usr/lib/x86_64-linux-gnu/

4、将库拷贝至/lib/x86_64-linux-gnu
cp libssl.so.1.1 /lib/x86_64-linux-gnu

以上步骤可以精简为绝对路径:
cp /snap/core20/1974/usr/lib/x86_64-linux-gnu/libssl.so.1.1 /lib/x86_64-linux-gnu
同理,如果报的错是其他库,也可以尝试这个方法,如libcrypto.so.1.1
error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

解决方法:

1、确定库所在位置
find / -name libcrypto.so.1.1
/snap/core20/1974/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1

2、将库拷贝至/lib/x86_64-linux-gnu
cp /snap/core20/1974/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 /lib/x86_64-linux-gnu

若对您有帮助,不妨动动小指头点个赞+关注再走哟~
博客园:https://www.cnblogs.com/helloyuany
在这里插入图片描述

CSDN:https://blog.csdn.net/helloyuanye
在这里插入图片描述

微信公众号:在这里插入图片描述