Below is some necessary context for understanding my questions (my shell is /bin/bash
by the way):
~
$ alias
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
alias ll='ls -al'
alias pip='pip3'
alias python='/usr/local/bin/python3'
~
$ which python
/usr/bin/python
~
$ which python3
/usr/local/bin/python3
~
$ python3 --version
Python 3.9.5
~
$ python --version
Python 3.9.5
~
$ ll /usr/bin/python*
lrwxr-xr-x 1 root wheel 75 Feb 1 2020 /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 Feb 1 2020 /usr/bin/python-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
lrwxr-xr-x 1 root wheel 75 Feb 1 2020 /usr/bin/python2 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 75 Feb 1 2020 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 Feb 1 2020 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 1 root wheel 31488 Oct 30 2020 /usr/bin/python3
lrwxr-xr-x 1 root wheel 76 Feb 1 2020 /usr/bin/pythonw -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
lrwxr-xr-x 1 root wheel 76 Feb 1 2020 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
~
$ ll /usr/local/bin/python*
lrwxr-xr-x 1 marshallmcquillen admin 38 May 18 06:14 /usr/local/bin/python3 -> ../Cellar/python@3.9/3.9.5/bin/python3
lrwxr-xr-x 1 marshallmcquillen admin 45 May 18 06:14 /usr/local/bin/python3-config -> ../Cellar/python@3.9/3.9.5/bin/python3-config
lrwxr-xr-x 1 marshallmcquillen admin 40 May 18 06:14 /usr/local/bin/python3.9 -> ../Cellar/python@3.9/3.9.5/bin/python3.9
lrwxr-xr-x 1 marshallmcquillen admin 47 May 18 06:14 /usr/local/bin/python3.9-config -> ../Cellar/python@3.9/3.9.5/bin/python3.9-config
My Questions:
Why is my alias for python not working? (I've also tried just having
alias python=python3
in my~/.bash_profile
and it still doesn't point to the correct binary)Why does the
python
link point to (what appears to be) a python2.7 binary, but the version shows 3.9.5?Is the answer to #1 or #2 somehow related to the difference between
brew install
andpip3 install
?