ImportError:无法打开共享对象文件:没有这样的文件或目录

时间:2014-05-23 15:30:00

标签: python swig importerror pybrain

我试图在PyBrain中使用arac,当我调用net.convertToFastNetwork()时,或者当我尝试导入arac.pybrainbridge(导入arac工作正常)时,我收到此错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pafnouti/Documents/Project/arac/src/python/arac/pybrainbridge.py", line 51, in <module>
    import arac.cppbridge as cppbridge
  File "/home/pafnouti/Documents/Project/arac/src/python/arac/cppbridge.py", line 31, in <module>
    _cppbridge = swig_import_helper()
  File "/home/pafnouti/Documents/Project/arac/src/python/arac/cppbridge.py", line 26, in swig_import_helper
    _mod = imp.load_module('_cppbridge', fp, pathname, description)
ImportError: libarac.so: cannot open shared object file: No such file or directory

来自此代码:

    try:
        fp, pathname, description = imp.find_module('_cppbridge', [dirname(__file__)])
    except ImportError:
        import _cppbridge
        return _cppbridge
    if fp is not None:
        try:
            print fp,"\n", pathname,"\n", description
            _mod = imp.load_module('_cppbridge', fp, pathname, description) # Fails here
            print "OK!"
        finally:
            fp.close()
        return _mod

如果我直接调用import _cppbridge,我会遇到同样的错误。 我在这里看到过这种错误,所以我试着解决它,因为它说:

locate libarac.so 
/usr/local/lib/libarac.so

此处libarac.so是指向其他地方的链接,但即使将其复制到/ usr / local / lib也无法正常工作

ls -l
total 0
lrwxrwxrwx. 1 root root 10 May 23 03:05 libarac.so -> libarac.so

我尝试用:

更改LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

和/etc/ld.so.conf一起使用/ usr / local / lib添加一个新行并调用sudo ldconfig,但它没有改变任何内容。

注意:我在使用Fedora 20。

我不知道它是否有链接,但由于我无法为arac编译测试,在SConstruct中我评论了一些内容:

# Then compile the tests.
#testenv = Environment(LIBS=['arac', 'gtest'], CPPPATH=CPPPATH, LIBPATH=LIBPATH)
#test = testenv.Program('test-arac', Glob('src/cpp/tests/*.cpp'))


swigenv = Environment(SWIGFLAGS=['-python', '-c++', '-outdir', 'src/python/arac'],
                      CPPPATH=CPPPATH + NUMPYPATH + PYTHONPATH,
                      LIBS=['arac'],
                      FRAMEWORKSFLAGS=frameworksflags,
                      LINKFLAGS=linkflags,
                      LIBPATH=LIBPATH,
                      LDMODULEPREFIX='src/python/arac/_',
                      LDMODULESUFFIX = '.so',
                      )
swig = swigenv.LoadableModule('cppbridge',
                             ['src/swig/cppbridge.i'])

# Declare some dependencies.
#Depends(test, lib)
Depends(swig, lib)

0 个答案:

没有答案