Anaconda activate

anaconda, linux

Solution

The easiest fix is to just put `/Users/mylaptop/anaconda` in your PATH, by adding something like

export PATH="/Users/mylaptop/anaconda:$PATH"

to your bash profile (`~/.profile`).

You can't put the activate script in a script because it has to be "sourced" to work. `source` causes the script to be run in your current shell (as opposed to a subshell, which is how the bash script you wrote is run). This is necessary because it modifies your `PATH` environment variable, and environment variables from your current shell cannot be modified by subshells.

Problem

I am using anaconda python. So every time, in my mac terminal, I input the terminal command: ``` source /Users/mylaptop/anaconda/bin/activate /Users/mylaptop/anaconda ``` And then I activated the anaconda python environment. But I don't want to write this command line every time, so I tried a bash script like this: ``` #! /bin/bash source /Users/mylaptop/anaconda/bin/activate /Users/mylaptop/anaconda ``` and I put this file in the directory `/usr/local/bin`. But unfortunately, I cannot log into anaconda environment in this way. There is no error message showed up in the terminal. So I do not know what is happening here. Could anyone help me out?

Original source