I need to use the Homebrew version of Python rather than the system version of Python. I have a clean install of macOS Sierra (10.12.5).
I first installed homebrew and then updated ~/.bash_profile
using nano ~/.bash_profile
.
Then I added this into the file:
# Homebrew
export PATH=/usr/local/bin:$PATH
Then, I needed to manually source the ~/.bash_profile
file to ensure the changes have been reloaded using source ~/.bash_profile
.
I installed python using brew install python
and tried to link using brew linkapps python
The output was this:
Warning: Already linked: /usr/local/Cellar/python/2.7.13_1
To relink: brew unlink python && brew link python
Gautams-Air:~ gautam$ which python
/usr/bin/python
Gautams-Air:~ gautam$ python -V
Python 2.7.10
Gautams-Air:~ gautam$ brew linkapps python
Warning: brew linkapps has been deprecated and will eventually be removed!
Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using
either aliases or symlinks and Homebrew formulae do not build "proper" .app
bundles that can be relocated. Instead, please consider using brew cask and
migrate formulae using .app's to casks.
Linking: /usr/local/opt/python/IDLE.app
Linking: /usr/local/opt/python/Python Launcher.app
Linked 2 apps to /Applications`
Using which python
the output was:
/usr/bin/python
It should have been: /usr/local/bin/python
I also tried using: brew unlink python && brew link python
Also using python -V
it shows Python 2.7.10
although the current version in Homebrew is Python 2.7.13
How do I use the Homebrew version of Python instead of the system version of Python? - How do I do the linking?
USING: macOS Sierra (10.12.5)