2

I'm running Centos 6.3 with python 2.6 and trying to use pyexiv2, but I'm getting an import error, file not found when I import pyexiv2. Here is the text of the error

     Traceback (most recent call last):
  File "/home/chuck/bin/pylib/test.py", line 13, in 
    import pyexiv2
  File "/usr/lib64/python2.6/site-packages/pyexiv2/__init__.py", line 60, in 
    import libexiv2python
ImportError: libexiv2.so.12: cannot open shared object file: No such file or directory

However, libexiv2.so.12 is in /usr/local/lib. How can I make this visible to python?

How I installed pyexiv2:
I removed the stock exiv2 and built the latest version, 0.23, from source. I used the build defaults and it installed into /usr/local. I installed the stock boost libraries, version 1.41. I downloaded the latest pyexiv2 and built that using the recommended build tool scons. After I got the import error I put a soft link to libexiv2.so.12 in /lib. Also, my ld.so.conf contains a listing for /usr/local/lib.

Any help is greatly appreciated.

4

1 回答 1

1

这个问题在 stackoverflow 上的另一个线程中得到了很好的回答,为什么 Python 找不到 sys.path 目录中的共享对象。原来我在 /etc/ld.so.conf 添加条目后忘记运行 ldconfig。哎呀。将 /usr/local/lib 添加到 $LD_LIBRARY_PATH 并在 /etc/ld.so.conf 中有一个活动条目都解决了我的问题。

于 2012-11-27T20:28:13.923 回答