How to link home brew python version and set it as default How to link home brew python version and set it as default python python

How to link home brew python version and set it as default


After installing python3 with brew install python3I was getting the error:

Error: An unexpected error occurred during the `brew link` stepThe formula built, but is not symlinked into /usr/localPermission denied @ dir_s_mkdir - /usr/local/FrameworksError: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

After typing brew link python3 the error was:

Linking /usr/local/Cellar/python/3.6.4_3... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

To solve the problem:

sudo mkdir -p /usr/local/Frameworkssudo chown -R $(whoami) /usr/local/*brew link python3

After this, I could open python3 by typing python3 👍

(From https://github.com/Homebrew/homebrew-core/issues/20985)


In the Terminal, type:

brew link python


If you used

brew install python

before 'unlink'you got

brew info python/usr/local/Cellar/python/2.7.11python -VPython 2.7.10

so do

brew unlink python && brew link python

and open a new terminal shell

python -VPython 2.7.11