问题
I am having issues trying to import this .so file in Python...I added this to my /etc/bashrc
and source
'd it to make it reload...no luck so far...
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
The file DOES exist at /usr/local/lib/lobzookeeper_mt.so.2
File "build/bdist.linux-x86_64/egg/zookeeper.py", line 7, in <module>
File "build/bdist.linux-x86_64/egg/zookeeper.py", line 6, in __bootstrap__
ImportError: libzookeeper_mt.so.2: cannot open shared object file: No such file or directory
I have no idea what to do at this point, anyone have an idea on what I am doing wrong? I am using Centos 6 64 bit too btw.
回答1:
Attempting to load a library will, confusingly, fail with "no such file or directory" if a dependency of the library you're trying to load cannot be found. Run ldd
:
ldd /path/to/your/library.so
and look for the words "not found" to check if this is the case.
回答2:
export LD_LIBRARY_PATH=/usr/local/lib
may solve your problem
回答3:
- temporary way:export LD_LIBRARY_PATH=/usr/local/lib
- permanent way:edit /root/.bashrc, add following lines:
- export LD_LIBRARY_PATH=/usr/local/lib
来源:https://stackoverflow.com/questions/15536171/error-importing-zookeeper-libzookeeper-mt-so-2-in-python