Whenever i enter into terminal to open python, Command 'python' not found, did you mean: command 'python3' from deb python3
I've installed ubuntu 20.04.3 lts, and I installed anaconda3 twice, first time from user privilege and once again from root privilege since not being activated conda. when i reopened the terminal, i need to type the command to be activated conda. But If i type '$whereis conda', it doesn't show the bin directory where it was actually installed. I typed like given below,
hilipkumar@thilipkumar-Inspiron-5520:~$ python
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
thilipkumar@thilipkumar-Inspiron-5520:~$ whereis conda
conda: /home/thilipkumar/anaconda3/condabin/conda
thilipkumar@thilipkumar-Inspiron-5520:~$ source /home/thilipkumar/anaconda3/bin/activate
(base) thilipkumar@thilipkumar-Inspiron-5520:~$ conda init
no change /home/thilipkumar/anaconda3/condabin/conda
no change /home/thilipkumar/anaconda3/bin/conda
no change /home/thilipkumar/anaconda3/bin/conda-env
no change /home/thilipkumar/anaconda3/bin/activate
no change /home/thilipkumar/anaconda3/bin/deactivate
no change /home/thilipkumar/anaconda3/etc/profile.d/conda.sh
no change /home/thilipkumar/anaconda3/etc/fish/conf.d/conda.fish
no change /home/thilipkumar/anaconda3/shell/condabin/Conda.psm1
no change /home/thilipkumar/anaconda3/shell/condabin/conda-hook.ps1
no change /home/thilipkumar/anaconda3/lib/python3.8/site-packages/xontrib/conda.xsh
no change /home/thilipkumar/anaconda3/etc/profile.d/conda.csh
no change /home/thilipkumar/.bashrc
No action taken.
(base) thilipkumar@thilipkumar-Inspiron-5520:~$ source ~/.bashrc
thilipkumar@thilipkumar-Inspiron-5520:~$ conda config --set auto_activate_base False
thilipkumar@thilipkumar-Inspiron-5520:~$ python
Python 3.8.8 (default, Apr 13 2021, 19:58:26)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
thilipkumar@thilipkumar-Inspiron-5520:~$
And i need to follow the same thing in root privilege too. If once i close and reopen the terminal, i need to do the same thing. Can anyone tell me a suggestion to solve this problem? And last few lines of $vi .bashrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/thilipkumar/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/thilipkumar/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/thilipkumar/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/thilipkumar/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
And echo $PATH
before activated
thilipkumar@thilipkumar-Inspiron-5520:~$ echo $PATH
/home/thilipkumar/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
thilipkumar@thilipkumar-Inspiron-5520:~$
Your system reacts perfectly normal when you type python
. There is no executable python on a default Ubuntu install.
On a default new install of Ubuntu 20.04, python
is not present. So it is quite expected then that the command is not found. You can, however, install a command python
that redirects to python3
or one that redirects to Python 2.7, in which case Python 2 will be installed - it does not come by default on Ubuntu 20.04.
You can make your python
command available by installing one of the python-is*
packages:
sudo apt install python-is-python3
will install a symbolic link /usr/bin/python
that links to python3
in the same folder.
There is probably no need for you to do that since you are using anaconda. That is a tool that allows to use different python versions on the same system for developping and testing. It is of course very fine to use that, but do in no way tamper with the system installed python3. A linux desktop heavily relies on its system default python. Tampering with it will most likely break your system.
Do not play with anaconda or with any other user application as root. This is never needed, unless you like adventure and do not mind breaking your system now and then.