我已经为此奋斗了很长一段时间。我正在尝试安装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

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

最佳答案

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

10-06 01:45