OSError:无法打开共享对象文件:即使文件位于文件夹中,也没有此类文件或目录

时间:2015-02-12 15:54:03

标签: python module makefile

我已经和它斗争了很长一段时间了。我正在尝试安装Yaafe以进行音频功能提取。我按照此处的说明操作:https://github.com/Yaafe/Yaafe

一切安装得很好,但是当我尝试运行测试文件“frames.py”时,我收到以下错误:

  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中,并带有以下命令:

export LD_LIBRARY_PATH=/usr/local/lib

事实上,当我回应LIBRARY_PATH时,它就在那里。另外,当我检查/ usr / local / lib时,它有以下内容:

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

所以不应该一切都好吗?我不明白是什么问题。我已按照说明进行操作。

1 个答案:

答案 0 :(得分:4)

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