Home > Net >  python path directing to older version in PATH
python path directing to older version in PATH

Time:01-19

In Linux when I issue the following command:

echo $PATH

/opt/python/3.10.8/bin/python3:/home/d5291029/.local/bin:/home/d5291029/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/puppetlabs/bin

I get this. My .bash_profile is this:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

PATH=/opt/python/3.10.8/bin/python3:$PATH

When I source the changes in bash_profile source .bashprofile and hit:

python3
Python 3.6.8 (default, Jun 14 2022, 12:54:58)

So even though my python is version 3.10 , my path still defaults to the system installation version of python which is 3.6.8. Why is that ?

CodePudding user response:

PATH should contain directory paths, not program.

You can fix this:

PATH=/opt/python/3.10.8/bin:$PATH

Don't forget to logout or exec bash to reload your .bash_profile.

  • Related