Ubuntu: Append but not add to $PATH



Question:

I'm working with 16.04.2 LTS. I've added miniconda to allow me to get access to python3.6 ( The system python is 3.5 ). I changed my .bashrc by adding

export PATH=~/miniconda3/bin:$PATH  alias python3.6='/home/deploy/miniconda3/bin/python3.6'  

However I notice that:

deploy@server:~$ python -V  Python 3.6.0 :: Continuum Analytics, Inc.  

Checking $PATH I see:

deploy@server:~$ echo $PATH  /home/deploy/bin:/home/deploy/.local/bin:/home/deploy/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games  

So I think that I am causing the system to take the first python it finds (miniconda 3.6), instead of the native 3.5 version. How can I change my .bashrc to APPEND instead of add the path so I assume it will go back to using the native version?


Solution:1

When you are creating an alias to python3.6 then there is no need to add it to your PATH unless there are some other utilities in that path which you want to have access them using bash.

If that's the case then in your .bashrc use something like:

export PATH=$PATH:~/miniconda3/bin  

it will put your ~/miniconda3/bin at the end of PATH environment variable so your native applications will not be overridden.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »