title: pg_config executable not found
body: <p>I am having trouble installing psycopg2. I get the following error when I try to <code>pip install psycopg2</code>:</p>
  
  <pre><code>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/psycopg2
  </code></pre>
  
  <p>But the problem is <code>pg_config</code> is actually in my <code>PATH</code>; it runs without any problem:</p>
  
  <pre><code>$ which pg_config
  /usr/pgsql-9.1/bin/pg_config
  </code></pre>
  
  <p>I tried adding the pg_config path to the <code>setup.cfg</code> file and building it using the source files I downloaded from their website (<a href="http://initd.org/psycopg/" rel="noreferrer">http://initd.org/psycopg/</a>) and I get the following error message!</p>
  
  <pre><code>Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'
  </code></pre>
  
  <p>But it is actually THERE!!!</p>
  
  <p>I am baffled by these errors. Can anyone help please?</p>
  
  <p>By the way, I <code>sudo</code> all the commands. Also I am on RHEL 5.5.</p>