0

I have installed both native Python 3 and Anaconda Python 3 however, at the moment, I want to use native Python 3 when I enter $ python. Do you know why it defaults to Anaconda Python 3 and how can I fix it?

$ echo $PATH
/usr/local/cuda-10.0/bin:/miniconda/bin:/scratch3/MATLAB/matlab/bin:/home/grad3/jalal/.local/bin:/opt/rh/rh-php70/root/bin:/scratch2/system/opt/pycharm-community-2018.1.2/bin:/scratch2/google-cloud-sdk/bin:/scratch2/google-cloud-sdk/bin:/usr/local/cuda-10.0/bin:/miniconda/bin:/scratch3/MATLAB/matlab/bin:/home/grad3/jalal/.local/bin:/opt/rh/rh-php70/root/bin:/scratch2/system/opt/pycharm-community-2018.1.2/bin:/scratch2/google-cloud-sdk/bin:/scratch2/google-cloud-sdk/bin:/usr/local/cuda-10.0/bin:/miniconda/bin:/scratch3/MATLAB/matlab/bin:/home/grad3/jalal/.local/bin:/opt/rh/rh-php70/root/bin:/scratch2/system/opt/pycharm-community-2018.1.2/bin:/scratch2/google-cloud-sdk/bin:/scratch2/google-cloud-sdk/bin:/usr/local/cuda-10.0/bin:/miniconda/bin:/scratch3/MATLAB/matlab/bin:/home/grad3/jalal/.local/bin:/opt/rh/rh-php70/root/bin:/scratch2/system/opt/pycharm-community-2018.1.2/bin:/scratch2/google-cloud-sdk/bin:/scratch2/google-cloud-sdk/bin:/usr/local/cuda-10.0/bin:/miniconda/bin:/scratch3/MATLAB/matlab/bin:/home/grad3/jalal/.local/bin:/opt/rh/rh-php70/root/bin:/scratch2/system/opt/pycharm-community-2018.1.2/bin:/scratch2/google-cloud-sdk/bin:/scratch2/google-cloud-sdk/bin:/scratch/sjn-p3/anaconda/anaconda3/bin:/home/grad3/jalal/.cargo/bin:/usr/local/cuda-10.0/bin:/miniconda/bin:/scratch3/MATLAB/matlab/bin:/home/grad3/jalal/.local/bin:/opt/rh/rh-php70/root/bin:/scratch2/system/opt/pycharm-community-2018.1.2/bin:/scratch2/google-cloud-sdk/bin:/scratch2/google-cloud-sdk/bin:/scratch/sjn-p3/anaconda/anaconda3/bin:/usr/lib64/qt-3.3/bin:/scratch/sjn-p3/anaconda/anaconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/IT/bin:/home/grad3/jalal/bin:/scratch/sjn-p2/anaconda/anaconda2/bin:/usr/bin/python3

and

$ which -a python
alias python='python3'
    /scratch/sjn-p3/anaconda/anaconda3/bin/python3
    /scratch/sjn-p3/anaconda/anaconda3/bin/python3
    /usr/bin/python3
/scratch/sjn-p3/anaconda/anaconda3/bin/python
/scratch/sjn-p3/anaconda/anaconda3/bin/python
/usr/bin/python
/scratch/sjn-p2/anaconda/anaconda2/bin/python

I have the following in my ~/.bashrc:

export PATH=$PATH:/usr/bin/python3
alias python=python3

I want to enter $ python and be able to use /usr/bin/python3

2
  • The alias is a good start, but /usr/bin must be in the PATH before the anaconda directories. By the way, since PATH is a list of directories and /usr/bin/python3 is not a directory, it doesn't make sense to put /usr/bin/python3 in the PATH. Commented Mar 23, 2021 at 23:57
  • update-alternatives should help you
    – Panki
    Commented Mar 24, 2021 at 9:39

0

You must log in to answer this question.

Browse other questions tagged .