Import error ghmm library

久未见 提交于 2019-12-06 07:41:17

问题


i get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/ghmm.py", line 112, in <module>
    import ghmmwrapper
  File "/usr/local/lib/python2.6/dist-packages/ghmmwrapper.py", line 25, in <module>
    _ghmmwrapper = swig_import_helper()
  File "/usr/local/lib/python2.6/dist-packages/ghmmwrapper.py", line 21, in swig_import_helper
    _mod = imp.load_module('_ghmmwrapper', fp, pathname, description)
ImportError: libghmm.so.1: cannot open shared object file: No such file or directory

but

root@ubuntu:~# sudo locate libghmm
/usr/local/lib/libghmm.a
/usr/local/lib/libghmm.la
/usr/local/lib/libghmm.so
/usr/local/lib/libghmm.so.1
/usr/local/lib/libghmm.so.1.0.0

Why go i get this error? i tried adding

/usr/local/lib/

to my PYTHONPATH

but it didn't work.


回答1:


PYTHONPATH is working for python modules, not for system libraries.

You can add the local path to your system:

  1. Edit as root /etc/ld.so.conf
  2. Add a new line with /usr/local/lib
  3. Save and quit
  4. Run "sudo ldconfig"

Then restart your application, it will work.

If you don't want to change anything to your system, you can use the environment variable:

LD_PRELOAD_PATH=/usr/local/lib python <yourapp.py>



回答2:


cd ~  
vi .bashrc  
#at the end of file add:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
# relogin terminal



回答3:


Try to just execute sudo ldconfig for run-time bindings.



来源:https://stackoverflow.com/questions/9216059/import-error-ghmm-library

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