cannot install python using brew
<p>Trying to install python using the following command:</p>

<p><code>brew install python</code></p>

<p>But unfortunately I am getting the following error:</p>

<pre><code>&gt;brew install python
==&gt; Downloading https://homebrew.bintray.com/bottles/python-2.7.12_2.el_capitan.
Already downloaded: /Users/maguerra/Library/Caches/Homebrew/python-2.7.12_2.el_capitan.bottle.tar.gz
==&gt; Pouring python-2.7.12_2.el_capitan.bottle.tar.gz
==&gt; Using the sandbox
==&gt; /usr/local/Cellar/python/2.7.12_2/bin/python -s setup.py --no-user-cfg insta
Last 15 lines from /Users/maguerra/Library/Logs/Homebrew/python/post_install.01.python:
copying setuptools/command/rotate.py -&gt; build/lib/setuptools/command
copying setuptools/command/saveopts.py -&gt; build/lib/setuptools/command
copying setuptools/command/sdist.py -&gt; build/lib/setuptools/command
copying setuptools/command/setopt.py -&gt; build/lib/setuptools/command
copying setuptools/command/test.py -&gt; build/lib/setuptools/command
copying setuptools/command/upload.py -&gt; build/lib/setuptools/command
copying setuptools/command/upload_docs.py -&gt; build/lib/setuptools/command
creating build/lib/setuptools/extern
copying setuptools/extern/__init__.py -&gt; build/lib/setuptools/extern
copying setuptools/script (dev).tmpl -&gt; build/lib/setuptools
copying setuptools/script.tmpl -&gt; build/lib/setuptools
running install_lib
copying build/lib/easy_install.py -&gt; /usr/local/lib/python2.7/site-packages
copying build/lib/pkg_resources/__init__.py -&gt; /usr/local/lib/python2.7/site-packages/pkg_resources
error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-  packages/pkg_resources/__init__.py'
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`

==&gt; Caveats
Pip and setuptools have been installed. To update them 
  pip install --upgrade pip setuptools

You can install Python packages with
  pip install &lt;package&gt;

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: https://github.com/Homebrew/brew/blob/master/docs/Homebrew-and Python.md

.app bundles were installed.
Run `brew linkapps python` to symlink these to /Applications.
==&gt; Summary
í ¼í½º  /usr/local/Cellar/python/2.7.12_2: 3,150 files, 42.5M
</code></pre>

<p>Has anyone seen this before, or now how to address this issue in order to complete the python installation process? </p>

<p>The error message says you donât have permission to write under <code>/usr/local/lib/python2.7/site-packages/pkg_resources</code>.</p>

<p>The following steps should work:</p>

<ol>
<li><p>Remove your broken Python install:</p>

<pre><code>brew uninstall python
</code></pre></li>
<li><p>Ensure you own that directory:</p>

<pre><code>sudo chown -R $(whoami):admin /usr/local/lib/python2.7/site-packages
</code></pre></li>
<li><p>Retry:</p>

<pre><code>brew install python
</code></pre></li>
</ol>

python install homebrew