0

I am trying to follow this explanation of how to make an alias and made the following .bashrc file in my home directory. Here it is:

# .bashrc

# User specific aliases and functions
alias py='python3'
alias pip='pip3'

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

PATH=$PATH:/home/username/bin:/usr/local/homebrew
export PATH

I restarted my shell and ran "py" and got a "command not found" error. What am I doing wrong? Thanks

I tried the following as well:

# .bashrc

# User specific aliases and functions
alias py='/usr/bin/python3'
alias pip='/usr/bin/pip3'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

PATH=$PATH:/home/username/bin:/usr/local/homebrew
export PATH

as well as:

# .bashrc

# User specific aliases and functions
alias py='/usr/local/bin/python3'
alias pip='/usr/local/bin/pip3'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

PATH=$PATH:/home/username/bin:/usr/local/homebrew
export PATH

Both of these also gave a "command not found" error.

Mathew
  • 101
  • 1
  • type in a termnial whereis python3 then read the full path of the binary and provide this full path to your alias – cmak.fr May 15 '20 at 02:51
  • thanks for this, I tried your recommendation of using the full path but as you can see in my latest edit, neither of the paths given when I did 'whereis' and 'which' worked – Mathew May 15 '20 at 02:58
  • what does ls -l /usr/local/bin/python3 give you. –  May 15 '20 at 06:18
  • I get this when I run that command: lrwxr-xr-x 1 mathewlewis admin 34 14 May 02:37 /usr/local/bin/python3 -> ../Cellar/python/3.7.7/bin/python3 – Mathew May 15 '20 at 22:26

0 Answers0