我收到此错误:
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
但
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
为什么我会收到此错误?我尝试添加
/usr/local/lib/
到我的PYTHONPATH
但它不起作用。
答案 0 :(得分:5)
PYTHONPATH
适用于python模块,不适用于系统库。
您可以添加系统的本地路径:
/etc/ld.so.conf
/usr/local/lib
然后重启你的应用程序,它会起作用。
如果您不想对系统进行任何更改,可以使用环境变量:
LD_PRELOAD_PATH=/usr/local/lib python <yourapp.py>
答案 1 :(得分:3)
cd ~
vi .bashrc
#at the end of file add:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
# relogin terminal
答案 2 :(得分:0)
尝试执行 sudo ldconfig 以获取运行时绑定。