0
votes

Hey, I'm pretty new to linux (using Ubuntu 11.04) so bear with me here.

I downloaded psycopg2 2.4.1 from http://linux.softpedia.com/get/Database/Database-APIs/psycopg-6404.shtml

Then I try running...

python setup.py install

..While in the directory but then it tells me..

Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH or specify the full executable path with the option:

python setup.py build_ext --pg-config /path/to/pg_config build ...

... and I don't know how to get to the path of pg_config (and I can't even find it).

Thanks for any help.

2
any luck with apt-get?senderle

2 Answers

2
votes

You probably don't have it installed. I did this:

me@mine:~ $ pg_config
The program 'pg_config' is currently not installed.  You can install it by typing:
sudo apt-get install libpq-dev
me@mine:~ $ sudo apt-get install libpq-dev

Seemed to work.

Is there a reason you aren't installing psychopg via apt-get though? Because this would probably be the easiest solution:

sudo apt-get install python-psycopg2

FYI, many python packages are installable via apt-get, and the only thing to remember is that they generally have a python- prefix -- as in python-nltk, python-qt4-dev, and so on.

2
votes

Here's an easy solution if you find your pg_config:

find /opt /usr -name pg_config
# Take note of path
env PATH=${PATH}:/opt/local/lib/postgresql91/bin python setup.py build

Or wherever your installation of PostgreSQL dumped off your pg_config file.