My goal is to make sure that python refers to python3 in my mac terminal. What i have tried so far are the following two attempts
1. Adding an alias in .zshrc
alias python=python3
after re sourcing my .zshrc file this allowed me to type python --version and get python3.
This does not work for scripts as they specify #!/usr/bin/env python and completely ignore my aliases.
2. Adding a symlink from /usr/local/bin/python to /usr/bin/python3
This is when it gets weird. Here are the output of a few commands
python --version -> python 2.7
which python -> python /usr/local/bin/python
/usr/local/bin/python --version -> python 2.7
ls -l /usr/local/bin/python -> /usr/local/bin/python -> /usr/bin/python3
/usr/bin/python3 --version -> python 3.8
What is going wrong here? Why is the symlink apparently correct but the wrong version of python is still showing when using it?
I found a similar question on an old apple but the answer doesn't really address the weirdness of the symlink, nor doesnt it solve the problem.
I'd really like to understand why this is happening AND find a solutionn or a proper way to get my main python version to be python 3.
Thanks!