问题描述

error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

解决方案

1.编辑

vi /etc/ld.so.conf

如果是非root权限帐号登录,使用 sudo vi /etc/ld.so.conf

添加上python2.7的lib库地址,如 /usr/local/Python2.7/lib,保存文件

2.执行

/sbin/ldconfig -v 命令,如果是非root权限帐号登录,使用 sudo  /sbin/ldconfig -v。这样 ldd 才能找到这个库,执行python2.7就不会报错了

备注

/etc/ld.so.conf:这个文件记录了编译时使用的动态链接库的路径。

默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件,如果你安装了某些库,没有指定 --prefix=/usr 这样lib库就装到了/usr/local下,而又没有在/etc/ld.so.conf中添加/usr/local/lib,就会报错了

ldconfig:它是一个程序,通常它位于/sbin下,是root用户使用的东东,具体作用及用法可以man ldconfig查到,简单的说,它的作用就是将/etc/ld.so.conf列出的路径下的库文件 缓存到/etc/ld.so.cache 以供使用,因此当安装完一些库文件,(例如刚安装好glib),或者修改ld.so.conf增加新的库路径后,需要运行一下/sbin/ldconfig,使所有的库文件都被缓存到ld.so.cache中,如果没做,即使库文件明明就在/usr/lib下的,也是不会被使用的,结果编译过程中抱错,缺少xxx库。

linux - python - 异常:error while loading shared libraries的更多相关文章

  1. Cloning EBS from Linux 5 to Linux 6 Fails: "Error While Loading Shared Libraries: libclntsh.so.10.1

    SYMPTOMS    During clone Oracle Applications R12 from Linux 5 to Linux 6 the following error occurs ...

  2. 【linux排错】"error while loading shared libraries: xxx.so.x" 错误的原因和解决办法

    一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误, 比如: lcw: error : cannot open shared object file: No such file ...

  3. linux使用wkhtmltopdf报错error while loading shared libraries:

    官网提示 linux需要这些动态库.depends on: zlib, fontconfig, freetype, X11 libs (libX11, libXext, libXrender) 在li ...

  4. 解决 Linux error while loading shared libraries: cannot open shared object file: No such file or directory

    安装最新版本Emqtt,参照官方文档安装后,执行报错: Linux error while loading shared libraries libsctp.so.1: cannot open sha ...

  5. 【转】linux中执行外部命令提示" error while loading shared libraries"时的解决办法

    今天在Centos下编译kapar 后执行时出错,老说: [root@dc01 ~]# kapar kapar: error while loading shared libraries: libsc ...

  6. Linux上error while loading shared libraries问题解决方法

    在Linux环境执行程序时经常会遇到提示程序依赖动态库.so文件不存在的情况,出现报错"error while loading shared libraries: XXXX.so.XX: c ...

  7. linux下报错:error while loading shared libraries

    linux执行bin程序报: error while loading shared libraries:libncurses.so.5: cannot open shared object file: ...

  8. Linux从error while loading shared libraries: libxxx.so.x 错误的常规解决思路看程序与动态库的关系

    出现这类错误的原因通常是动态库无法被加载,本文介绍了常规的解决方案,适用多种情况: 创作不易,如果本文帮到了您: 如果本文帮到了您,请帮忙点个赞

  9. Linux中error while loading shared libraries错误解决办法

    默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件,通常通过源码包进行安装时,如果不指定--prefix,会将库安装在/usr/local/lib目录下:当运行程序需要链接动态库 ...

随机推荐

  1. vue 使用v-for进行循环

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. 使用 Apache James 3.3.0(开源免费) 搭建外网电子邮件服务器(基于 Windows + Amazon Corretto 8)

    对于邮件服务器的安装,请先参阅: 使用 Apache James 3.3.0(开源免费) 搭建内网电子邮件服务器(基于 Windows + Amazon Corretto 8) https://www ...

  3. Python学习零基础<入门必学>

    1. 注释注释 是任何存在于 # 号右侧的文字,其主要用作写给程序读者看的笔记. 2. 字面常量一个字面常量(Literal Constants)的例子是诸如 5.1.23 这样的数字,或者是如 这是 ...

  4. Blazor client-side + webapi (.net core 3.1) 添加jwt验证流程(非host)第二步 添加Identity

    添加Identity数据上下文 安装nuget包:Microsoft.AspNetCore.Identity.EntityFrameworkCore 创建ApplicationDbContext类 创 ...

  5. A tiny problem with integers

    # A tiny problem with integers 给定长度为N的数列A,然后输入M行操作指令. 第一类指令形如“C l r d”,表示把数列中第l~r个数都加d. 第二类指令形如“Q X” ...

  6. 简单的OO ALV显示ALV及下载

    REPORT OO_ALV. CLASS OO_ALV DEFINITION. PUBLIC SECTION. METHODS:GET_DATA IMPORTING AMOUNT TYPE I,&qu ...

  7. 关于MY Sql 查询锁表信息和解锁表

    1.查询锁住表信息 show OPEN TABLES where In_use > 0; 2.查看进程  show processlist; 3.解开锁住的表 需要杀掉锁住表的相关进程Id. k ...

  8. Linux中“没有可用的软件包XX,但是它被其他软件包引用”的解决方法

    踩坑经历 今天刚在虚拟机上安装好了ubuntu系统,在执行sudo apt install net-tools 命令时报错"没有可用的软件包net-tools,但是它被其他软件包引用&quo ...

  9. Linux安装ftp服务-详细步骤

    最近项目中用到了FTP服务器,于是整理了一份在Linux服务器上安装FTP的详细步骤供大家分享. 1.首先连接上自己的Linux服务器.我的Linux是CentOS 6 2.检查Linux服务器上是否 ...

  10. opencv —— copyTo 设置与操作感兴趣区域(ROI)

    感兴趣区域:ROI 对感兴趣区域进行的一系列操作,相当于直接在原图相应部分进行操作. Mat imageROI = srcImage(Rect(0,0,dstImage.cols, dstImage. ...