Homebrew python 2.7 vs OS X python 2.7

Viewed 3090

this is my first time asking a question here so sorry in advance if I'm doing something wrong. The problem is I installed python 2 using Homebrew to avoid using OS X system python (since it is recommended to do so), but when I type in the terminal - python, it is still using the system python.

which -a python gives: /usr/bin/python

writing python gives:

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit() 

and doing python2 gives:

Python 2.7.13 (default, Jul 18 2017, 09:16:53) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

I would like to just write python and not python2 to use the Homebrew version.

Also, echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin

and /etc/paths

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/etc/paths (END)

What should I do to use Homebrew python and not the default system python. P.D. I installed python 3 with Hombrew too.

2 Answers
Related