ImportError _psycopg.so: undefined symbol: lo_truncate64解决过程

遇到问题,束手无策,so 搜搜搜

看到一篇文件,然后操作后 解决了我的问题

整体过程 是重新软链接 一下原始的so文件

 

希望同样适用于你们

原链接:http://www.leeladharan.com/importerror-psycopg-so:-undefined-symbol:-lo-truncate64

To identify which libpq is the psycopg.so is using issue below command, the output of command should point to right libpq.so file which is latest

ldd /path/to/venv/lib/python2.6/site-packages/psycopg2/_psycopg.so | grep libpq
    libpq.so.5 => /usr/pgsql-9.4/lib/libpq.so.5 (0x00007f0d6c027000)

if above output is the correct .so file and you are still getting above error then, try to locate libpq.so in default libraries like /usr/lib64 (on centOS), For me it was below under /usr/lib64

lrwxrwxrwx.  1 root root       12 Mar 31 10:15 libpq.so.5 -> libpq.so.5.2
-rwxr-xr-x.  1 root root   162760 Feb 25  2014 libpq.so.5.2

As you can see the _psycopg.so for some reason is trying to load above libpq.so.5 which is an older one. So I removed this softlink file libpq.so.5 and created a new one which points to /usr/pgsql-9.4/lib/libpq.so.5 in /usr/lib64, by issuing below commands

cd /usr/lib64
rm libpq.so.5
ln -s /usr/pgsql-9.4/lib/libpq.so.5 libpq.so.5

Above should fix the issue.

posted @ 2018-01-18 11:18  踏雪无痕何处是  阅读(798)  评论(0)    收藏  举报