getting sublime text 3 to use anaconda python
Question: So I've installed anaconda to a directory I have privileges for but I can't
get sublime text 3 to recognise that the shell is now using anaconda python:

    
    
    >which python
    /local/home/USER/Apps/anaconda/bin/python
    

when I build with sublime launched from the same shell:

    
    
    import astropy
    print astropy.__file__
    

it gives a different directory: /soft/python-SL7/lib/python2.7/site-
packages/astropy/**init**.pyc

My .tcshrc file reads:

    
    
    setenv PATH /local/home/USER/Apps/anaconda/bin:${PATH}
    alias subl /local/home/USER/Apps/sublime_text_3/sublime_text
    

My .bashrc (not that it should be using it) reads:

    
    
    export PATH="/local/home/sread/Apps/anaconda/bin:$PATH"
    

Any ideas?


Answer: The easiest way is to create a new [build
system](http://docs.sublimetext.info/en/latest/file_processing/build_systems.html)
that points to your Anaconda installation. Create a new file in Sublime with
JSON syntax and the following contents:

    
    
    {
        "cmd": ["/local/home/USER/Apps/anaconda/bin/python", "-u", "$file"],
        "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
        "selector": "source.python"
    }
    

Save the file in your `Packages/User` directory (should be `~/.config/sublime-
text-3/Packages/User`) as `Anaconda.sublime-build`. Finally, select **`Tools →
Build System → Anaconda`** , and when you hit `Ctrl``B` in a Python file it
should now run using Anaconda.

If you want to set up
[`SublimeREPL`](https://packagecontrol.io/packages/SublimeREPL) to use
Anaconda with IPython in Sublime, you can follow the instructions
[here](http://stackoverflow.com/a/20861527/1426065) to set up the proper menu
option (altering the path to suit your environment, of course), and my gist
[here](https://gist.github.com/MattDMo/6cb1dfbe8a124e1ca5af) for setting up
SublimeREPL for IPython 4 and Jupyter.

