Installing Python3 alias mac

Hi - trying to get up and running on Mac - following the tutorial ‘installing python3 and python packages’

the alias doesn’t seem top work

This is copied from the bash file i’m editing

Setting PATH for Python 3.9

The original version is saved in .bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
export PATH
alias python="python3
alias pip=“pip3”

but then when i have saved it - closed terminal and reopened i write python version and it returns python2 version not 3 as the article says it should

  1. Execute open ~/.bash_profile from a Terminal (if the file was not found, then run touch ~/.bash_profile first).
  2. Copy and paste alias python="python3" into the now open .bash_profile file and save.
  3. While we’re at it, go ahead and copy and paste alias pip="pip3" into the file as well in order to create an alias for the Python 3 pip package manager.
  4. Finally, restart the Terminal and run python --version . We should see the exact same output as running python3 --version .

i’m a noob and if the answer is something really obvious i apologise

That’s ok no need to apologize, it’s not an easy topic.

Did you source ~/.bash_profile at any point?

1 Like

Since you mention mac are you on catalina? The default shell for the terminal app is now zsh so you’d want to be altering .zshrc or similar (I don’t think bash_profile is sourced in this case unless you specify it).

echo $SHELL should tell you. If it’s not zsh then you can ignore this.

2 Likes

yes i am on Catalina - and it is zsh
The default interactive shell is now zsh.

so what now?

Try the things you did but on .zshrc instead of .bash_profile.

2 Likes