Linux Question

change python default version in a remote server

I'm working in a remote server via ssh, where I have installed anaconda, which is now the default version.
For some scripts, I need to use the default version, where some libraries have been installed.

To do so, I have to use this line each time I log on the server:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"


Is there a way to avoid doing this each time I log?

Answer

A typical way of making it available on all interactive sessions of bash, is to put it in ~/.bashrc.

Do:

echo 'export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"' >>~/.bashrc

export will make the variable PATH an environment variable i.e. the variable will be available to all child processes of the shell.

If you want to make the modified variable available to the current session too, source the ~/.bashrc:

source ~/.bashrc