Trouble installing psycopg2 on CentOS


I'm trying to install psycopg2 on CentOS, I followed everything on this tutorial from "On with it: Installing Python 2.6" all the way to when it imports psycopg2, but when I try to import I get the following error:

 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/python2.6/lib/python2.6/site-packages/psycopg2/", line 69, in <module>
    from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: cannot open shared object file: No such file or directory

How to troubleshoot this?

10/6/2017 8:06:54 PM

Accepted Answer

psycopg2 is a python wrapper around the PostgreSQL libraries, so you need those installed on your system too.

Since you're using CentOS, try this from the command line to install the postgre libs.

yum install postgresql-libs

1/27/2011 7:58:08 PM

  1. Forget your tutorial.
  2. Install EPEL
  3. yum install python-psycopg2

Django supports Python 2.4 just fine. If you really need Python 2.6 you can also use EPEL (yum install python26) - but there's no psycopg2 package for it yet.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow