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?
To run the code, press Command B or go to Tools -> Build. As you can see, my Sublime Text is running Python 2.7. To change this to Python 3.7, we have to add a “Build System.”
For language specific settings, click Sublime Text > Preferences > Settings - More > Syntax Specific - User. Then save the file using the following format: LANGUAGE. sublime-settings. For Python-specific settings, save the file as Python.
The easiest way is to create a new build system 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 CtrlB in a Python file it should now run using Anaconda.
If you want to set up SublimeREPL
to use Anaconda with IPython in Sublime, you can follow the instructions here to set up the proper menu option (altering the path to suit your environment, of course), and my gist here for setting up SublimeREPL for IPython 4 and Jupyter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With