8

If I type which python I get no output and I have no success using Miniconda as default Python. I did set paths to ${HOME}/.profile but no success.

Here is my ${HOME}/.profile The last line is mine. What am I doing wrong? My goal is to point to Miniconda3 by default.

if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

export PATH="$PATH:/usr/bin/python3.6:/data/ubuntu/miniconda3/bin"

EDIT: /usr/bin/python3.6 is a valid path, I installed python 3.6 and miniconda3.

Ray
  • 2,200
YohanRoth
  • 181
  • 1
  • 1
  • 3

2 Answers2

2

Looking at what you've shown, I guess there are at least two issues.

First, your path is incorrect. You shouldn't set your path to "/usr/bin/python3.6". I think that's an executable. You should set your path to "/usr/bin/" (which should have been set for you). In that directory, there should be a symbolic link from "python3" to "python3.6" (in /usr/bin/ do a ls -al python*). If what you want is python3, then the above should fix your problem.

You should be able to type "which python3". I don't know what "python" should point to (i.e., python2 or python3...I've lost track if it still points to python2). So, if what you're after is python 2.X, then you should check to see if it has been installed on your system.

Miniconda is a completely different issue. If you've installed Miniconda, you probably need to do a conda activate. This would activate your base environment. Alternatively, if you want to find an environment, then conda activate <some environment>. If you check your path, activating a Miniconda environment essentially prepends its path in front of PATH.

(You might want to double-check that conda is in your path; that is, if it was correctly installed. i.e., which conda Also, the bottom of your ~/.bashrc should have been modified.)

Given what you asked, I guess the second solution is what you wanted. But you should fix your PATH variable anyway.

Ray
  • 2,200
1

You may not have a file or symbolic link in /usr/bin folder. I made a symbolic link to see something from which python command line:

ln -s /usr/bin/python3.6 /usr/bin/python

Cloud Cho
  • 693