Python: Anaconda path only added on demand
The situation is the following:
- So far I have only used pip to install any package I needed or also apt-get sometimes. I have installed things like tensorflow with gpu support and things like that. At least at the time I installed this I was not aware of an easy way to install tensorflow in anaconda with gpu support, so I decided to just install it on the regular/standard python.
- Now and for the future I intend to use anaconda. But I do not want to lose easy access to my old python libraries, but also not have to reinstall everything in anaconda.
- Now I installed anaconda. But when I now open Jupyter notebook I am in the conda python, as I have added the conda path.
Is there maybe an easy way to achieve the following: When I open a terminal, all I need to do is type a quick command that will only then add the anaconda path?
This is to achieve that when I just open the terminal and type jupyter notebook, my go to python distribution will be the distribution where I installed tensorflow and stuff. And then I can easily use the command to enter the anaconda environments.
The following line in the .bashrc will add the conda path:
$ export PATH=~/anaconda2/bin:$PATHSo my question probably boils down to this: Is there a way to link this with some sort of command? So that the following would happen if I open a terminal:
jupyter notebook--> jupyter notebook starts, NOT using anaconda. But when I do:
command_that_adds_the_anaconda_path
jupyter notebook--> jupyter notebook starts, using anaconda
Big thanks in advance. I am rather new to shell stuff. Any link to how to create such a command will be much appreciated. I looked for it, maybe using the wrong words, but haven't found exactly this.
11 Answer
export PATH=~/anaconda2/bin:$PATH. When run in a terminal session (as opposed to from ~/.profile or ~/.bashrc), it will only affect that session and its child processes.