OSError:无法打开共享库文件:即使该文件位于文件夹中,也没有此类文件或目录 [英] OSError: cannot open shared object file: No such file or directory even though file is in the folder

查看:441
本文介绍了OSError:无法打开共享库文件:即使该文件位于文件夹中,也没有此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为此战斗了很长时间.我正在尝试安装Yaafe进行音频功能提取.我在这里按照说明进行操作: https://github.com/Yaafe/Yaafe

I've been fighting with this for quite some time now. I'm trying to install Yaafe for audio feature extraction. I follow instructions here: https://github.com/Yaafe/Yaafe

一切安装都很好,但是当我尝试运行测试文件"frames.py"时,出现以下错误:

Everything installs up nicely, but when I try to run the test file "frames.py" I get following error:

  File "frames.py", line 6, in <module>
    from yaafelib import FeaturePlan, Engine, AudioFileProcessor 
  File "/usr/local/lib/python2.7/dist-packages/yaafelib/__init__.py", line 36, in <module>
    from yaafelib.core import (loadComponentLibrary,
  File "/usr/local/lib/python2.7/dist-packages/yaafelib/core.py", line 35, in <module>
    yaafecore = cdll.LoadLibrary('libyaafe-python.so')
  File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libyaafe-python.so: cannot open shared object file: No such file or directory

我已使用以下命令将lib目录包括到LD_LIBRARY_PATH中:

I have included the lib directory to LD_LIBRARY_PATH with following command:

export LD_LIBRARY_PATH=/usr/local/lib

确实,当我回显LIBRARY_PATH时,它就在那里.另外,当我检查/usr/local/lib时,它具有以下内容:

And indeed when I echo the LIBRARY_PATH it is there. Also when I check the /usr/local/lib it has following contents:

libyaafe-components.so         libyaafe-io.so             python2.7
libyaafe-components.so.0       libyaafe-io.so.0           python3.4
libyaafe-components.so.0.70.0  libyaafe-io.so.0.70.0      site_ruby
libyaafe-core.so               libyaafe-python.so         yaafe
libyaafe-core.so.0             libyaafe-python.so.0
libyaafe-core.so.0.70.0        libyaafe-python.so.0.70.0

所以一切都还好吗?我不明白这是什么问题.我已经按照指示进行了操作.

So shouldn't everything be okay? I don't understand what is the problem. I've followed instructions to the point.

推荐答案

更改代码,以便在发生异常之前立即打印os.environ.这样,您将看到Python进程是否设置了正确的环境.要检查的另一件显而易见的事情是您的Python进程是否具有足够的权限来打开和读取libyaafe-python.so.请注意,出于安全原因,默认情况下sudo会限制所调用命令的环境(请参见

Change your code so that you print os.environ right before that exception occurs. That way you will see whether the Python process has the correct environment set or not. The other obvious thing to check are whether your Python process has sufficient permission to open and read libyaafe-python.so. Note that sudo by default limits the environment of the invoked command, for security reasons (see here, for instance).

这篇关于OSError:无法打开共享库文件:即使该文件位于文件夹中,也没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆