title: How to install psycopg2 for python2.6 when there is also 2.7 installed?
body: <p>I tried to install psycopg2 for python2.6 but my system also has 2.7 installed.</p>
  
  <p>I did</p>
  
  <pre><code>&gt;sudo -E pip install psycopg2
  Downloading/unpacking psycopg2
    Downloading psycopg2-2.5.3.tar.gz (690kB): 690kB downloaded
    Running setup.py (path:/private/var/folders/yw/qn50zv_151bfq2vxhc60l8s5vkymm3/T/pip_build_root/psycopg2/setup.py) egg_info for package psycopg2
  
  Installing collected packages: psycopg2
    Running setup.py install for psycopg2
      building 'psycopg2._psycopg' extension
      cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -arch x86_64 -arch i386 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5.3 (dt dec pq3 ext)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DPG_VERSION_HEX=0x09010B -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/local/Cellar/postgresql91/9.1.11/include -I/usr/local/Cellar/postgresql91/9.1.11/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-intel-2.7/psycopg/psycopgmodule.o
  ...
  </code></pre>
  
  <p>You can see that pip is associating psycopg2 with python2.7 during the install process.  This pip install completed with a reported success result but when I ran a 2.6 script after that that imports psycopg2, it couldn't find it:</p>
  
  <pre><code>    import psycopg2
  ImportError: No module named psycopg2
  </code></pre>
  
  <p>How do I install psycopg2 for python2.6 when there is also 2.7 installed?</p>