Hello,
I got an error as follows, on running import pg command on python command line.
This seems to be some issue with libpq module for postgresql
Below is the steps that I followed to fix it.
1)I just checked which is the library directory for postgresql
pg_config --libdir
/usr/lib
2)Then I checked libpq.so module which is needed for the postgresql commands to work with python is present on the /usr/lib directory.
ldd /usr/local/lib/python2.7/dist-packages/_pg.so | grep libpq
libpq.so.5 => /usr/lib/libpq.so.5 (0x00007f0d6b943000)
3)I can see the libpq.so.5 is already on the path /usr/lib. The issue is that the header module for libpq was not installed for the command to run. So I installed it using the command below.
apt-get install libpq-dev
which fixed the issue and now I am able to run the pg command from python command line.
Regards
Syamkumar.M
I got an error as follows, on running import pg command on python command line.
Traceback (most recent call last):import pg
File "<stdin>", line 1, in <module>ImportError?: /usr/local/lib/python2.7/dist-packages/_pg.so: undefined symbol: PQescapeLiteral
File "/usr/local/lib/python2.7/dist-packages/pg.py", line 31, in <module>
from _pg import *
This seems to be some issue with libpq module for postgresql
Below is the steps that I followed to fix it.
1)I just checked which is the library directory for postgresql
pg_config --libdir
/usr/lib
2)Then I checked libpq.so module which is needed for the postgresql commands to work with python is present on the /usr/lib directory.
ldd /usr/local/lib/python2.7/dist-packages/_pg.so | grep libpq
libpq.so.5 => /usr/lib/libpq.so.5 (0x00007f0d6b943000)
3)I can see the libpq.so.5 is already on the path /usr/lib. The issue is that the header module for libpq was not installed for the command to run. So I installed it using the command below.
apt-get install libpq-dev
which fixed the issue and now I am able to run the pg command from python command line.
Regards
Syamkumar.M
No comments:
Post a Comment