I have often seen people recommending to setup an alias in one's .bash_profile
or .zshrc
along the lines of
alias python='python3'
This seems like a convenient idea, however, as far as I understand, python2 is still installed for compatibility reasons, so won't creating such an alias break certain things?
Best Answer
From
man bash
So unless you explicitly set an option, aliases aren't expanded in scripts and any reference to
python
will call the binary directly. For interactive use it's probably best to callpython2
directly if you rely on pre-3 syntax/functionality.PS: AFAIK it's the same for
zsh
.