title: Python( Django ) pip install psycopg2 error in MacOS
body: <p>I set the virtualenv for my project and when I want to run </p>
  
  <p><strong>pip install psycopg2</strong> </p>
  
  <p>I get an error below</p>
  
  <pre><code>ERROR: Complete output from command python setup.py egg_info:
  ERROR: running egg_info
  creating pip-egg-info/psycopg2.egg-info
  writing pip-egg-info/psycopg2.egg-info/PKG-INFO
  writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
  writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
  writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
  
  Error: pg_config executable not found.
  
  pg_config is required to build psycopg2 from the source.  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'.
  
  If you prefer to avoid building psycopg2 from source, please install the PyPI
  'psycopg2-binary' package instead.
  
  For further information please check the 'doc/src/install.rst' file (also at
  &lt;http://initd.org/psycopg/docs/install.html&gt;).
  ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/r5/mt37g42j2h3b676lpx3qlznm0000gn/T/pip-install-yijundiy/psycopg2/
  </code></pre>
  
  <p>after that, I run brew install postgresql and then when I wanted to run :</p>
  
  <p>pip install psycopg2 I got this error:</p>
  
  <pre><code>Running setup.py install for psycopg2 ... error
        Running setup.py install for psycopg2 ... error
          ERROR: Complete output from command 
      ERROR: Command "/Users/masoudmk/Desktop/Masoud/projectenv/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/private/tmp/pip-install-6qi9xbe0/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-t8hmiffn/install-record.txt --single-version-externally-managed --compile --install-headers /Users/masoudmk/Desktop/Masoud/projectenv/bin/../include/site/python3.7/psycopg2" failed with error code 1 in /private/tmp/pip-install-6qi9xbe0/psycopg2/
  </code></pre>
  
  <p>In addition, when I use this command</p>
  
  <p><strong>sudo python setup.py install</strong></p>
  
  <p>I get this error too:</p>
  
  <pre><code>(null): can't open file 'setup.py': [Errno 2] No such file or directory
  </code></pre>
  
  <p>What should I do!?</p>