0

Trying to install python using the following command:

brew install python

But unfortunately I am getting the following error:

>brew install python ==> 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 ==> Pouring python-2.7.12_2.el_capitan.bottle.tar.gz ==> Using the sandbox ==> /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 -> build/lib/setuptools/command copying setuptools/command/saveopts.py -> build/lib/setuptools/command copying setuptools/command/sdist.py -> build/lib/setuptools/command copying setuptools/command/setopt.py -> build/lib/setuptools/command copying setuptools/command/test.py -> build/lib/setuptools/command copying setuptools/command/upload.py -> build/lib/setuptools/command copying setuptools/command/upload_docs.py -> build/lib/setuptools/command creating build/lib/setuptools/extern copying setuptools/extern/__init__.py -> build/lib/setuptools/extern copying setuptools/script (dev).tmpl -> build/lib/setuptools copying setuptools/script.tmpl -> build/lib/setuptools running install_lib copying build/lib/easy_install.py -> /usr/local/lib/python2.7/site-packages copying build/lib/pkg_resources/__init__.py -> /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` ==> Caveats Pip and setuptools have been installed. To update them pip install --upgrade pip setuptools You can install Python packages with pip install <package> 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. ==> Summary 🍺 /usr/local/Cellar/python/2.7.12_2: 3,150 files, 42.5M 

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

2 Answers 2

2

The error message says you don’t have permission to write under /usr/local/lib/python2.7/site-packages/pkg_resources.

The following steps should work:

  1. Remove your broken Python install:

    brew uninstall python 
  2. Ensure you own that directory:

    sudo chown -R $(whoami):admin /usr/local/lib/python2.7/site-packages 
  3. Retry:

    brew install python 
Sign up to request clarification or add additional context in comments.

1 Comment

I had to update my path to this: sudo chown -R $(whoami):admin /Users/YourUser/Library/Python/2.7/lib/python/site-packages for it to find it.
1

Install Python3 with Brew Enter brew command into terminal

brew install python3 

Optional, PATH environment Set up PATH environment variable, if you used HomeBrew to install Python3, then HomeBrew already added PATH.

Do not change PATH environment if you can launch python3 from terminal.

Add the following line to your ~/.profile file

export PATH=/usr/local/bin:/usr/local/sbin:$PATH 

Usually your Python installation directory looks like this, add it to your PATH

PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}" 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.