如何在 ubuntu 12.04 中设置 LD_LIBRARY_PATH?
在 .bashrc 中
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/blpapi_cpp/Linux
在 /etc/environment 中
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ubuntu/blpapi_cpp/Linux
文件存在
ls /home/ubuntu/blpapi_cpp/Linux/libblpapi3_64.so
/home/ubuntu/blpapi_cpp/Linux/libblpapi3_64.so
sudo ldconfig
但我仍然收到 importError:libblpapi3_64.so:无法打开共享对象文件:没有此文件或目录
Traceback (most recent call last):
File "/home/ubuntu/workspace/druidry-codebase/test.py", line 4, in <module>
import blpapi
File "/usr/local/lib/python2.7/dist-packages/blpapi/__init__.py", line 5, in <module>
from .internals import CorrelationId
File "/usr/local/lib/python2.7/dist-packages/blpapi/internals.py", line 50, in <module>
_internals = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/blpapi/internals.py", line 46, in swig_import_helper
_mod = imp.load_module('_internals', fp, pathname, description)
ImportError: libblpapi3_64.so: cannot open shared object file: No such file or directory
我该如何解决这个问题?
答案1
我在 .profile 中的 c++ SDK 目录中添加了一行 LD_LIBRARY_PATH,问题就解决了。