I'm trying to set up python as an alias on my git bash and I've edited both my .bashrc and .bash_profile to have the alias. I've edited both files and I am still getting a command not found prompt within Git Bash:
bash-screenshot
.bashrc and .bash_profile:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
# Enable tab completion
source ~/git-completion.bash
alias python="~\AppData\Local\Programs\Python\Python35\python.exe"
Anybody have any ideas?
1 Answer 1
Unlike python, backslashes not escaping anything are removed in bash.
So
alias python="~\AppData\Local\Programs\Python\Python35\python.exe"
creates an alias to ~AppDataLocalProgramsPythonPython35python.exe
Fix:
alias python="~/AppData/Local/Programs/Python/Python35/python.exe"
or just set the path (.exe suffix is supported on Windows flavours of bash)
export PATH=$PATH:~/AppData/Local/Programs/Python/Python35
(so programs not having access to aliases/shell built-ins can still run python using subprocess or exec)
C:\Users\<username>\AppData\Local\Programs\Python\Python35\python.exealias python=~/AppData/Local/Programs/Python/Python35/python.exe