OSError: cannot open shared object file: No such file or directory even though file is in the folder

匿名 (未验证) 提交于 2019-12-03 08:51:18

问题:

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

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 

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

export LD_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.

回答1:

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).



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!