0

Complete newbie here, trying to set up Django to work with PostgreSQL. I am using Ubuntu 14.10 and I have also installed PostgreSQL 9.5.
When I run pip install psycopg2 in terminal I get the following error:

Collecting psycopg2
Using cached psycopg2-2.6.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found

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 ...

or with the pg_config option in 'setup.cfg'.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-la8dJp/psycopg2

I know that directory containing pg_config is /opt/PostgreSQL/9.5/bin/pg_config but I don't know how to add this directory to PATH to get my psycopg2 installed. Or any another method to get psycopg2 installed so that I can interact with my PostgreSQL.

Thanking you in advance.

Dušan Maďar
  • 7,399
  • 4
  • 30
  • 51
user2719152
  • 671
  • 3
  • 9
  • 16

1 Answers1

0

Unless you do have a hard requirement on using the native postgresql library, I would advise you to use the pg8000 library instead because this one is pure python.

Since I discovered it years ago, I stopped using the other one and forgot about the having to compile it on so many platforms.

sorin
  • 137,198
  • 150
  • 472
  • 707