I just started using Sublime+SublimeREPL recently to code in python. I also use the IPython console within sublimeREPL to send the code, but the truth is that I am not using it adequately.
When I launch the IPython console with SublimeREPL I don't see the standard IPython message with details of the installation, I just see:
IPython Console 3.2.0
In [1]:
when I do pwd
, I obtain the following directory independently of the directory I start sublime from:
In [1]: pwd
Out[1]: u'/Users/javier/Library/Application Support/Sublime Text 3/Packages'
In general, it seems that IPython works (I have not fully tested most of my code) but I am sure the fact that sublime does not "see" the default IPython will be problematic in the future.
This question relates to this, but I have tried some of the options described in there, such as adding to SublimeREPL > Settings > User
:
{
"default_extend_env": {"PATH": "{PATH};/anaconda/bin/"}
}
and I can't make it work.
In case is of any help, sys.path
returns
In [3]: sys.path
Out[3]:
['',
'/anaconda/lib/python27.zip',
'/anaconda/lib/python2.7',
'/anaconda/lib/python2.7/plat-darwin',
'/anaconda/lib/python2.7/plat-mac',
'/anaconda/lib/python2.7/plat-mac/lib-scriptpackages',
'/anaconda/lib/python2.7/lib-tk',
'/anaconda/lib/python2.7/lib-old',
'/anaconda/lib/python2.7/lib-dynload',
'/anaconda/lib/python2.7/site-packages',
'/anaconda/lib/python2.7/site-packages/PIL',
'/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3-py2.7.egg',
'/anaconda/lib/python2.7/site-packages/progressbar-2.3-py2.7.egg',
'/anaconda/lib/python2.7/site-packages/runipy-0.1.1-py2.7.egg',
'/anaconda/lib/python2.7/site-packages/setuptools-18.0.1-py2.7.egg',
'/anaconda/lib/python2.7/site-packages/IPython/extensions',
'/Users/javier/.ipython']
And following this link when I do:
import os
try:
user_paths = os.environ['PYTHONPATH'].split(os.pathsep)
except KeyError:
user_paths = []
In [2]: user_paths
Out[2]: []
which I guess it means that I have not defined a PYTHONPATH
variable.
Finally, in the first of the links I mentioned they write: "SublimeREPL
doesn't run ipython
executable directly - it uses its API to start the console, therefore IPython
needs to be importable, what means it needs to be on PYTHONPATH
. So, extend default_extend_env config with PYTHONPATH
pointing it to IPython
source folder."
I am not entirely sure what it means. My default IPython
is at Anaconda/bin
but as I mentioned before, when I set "default_extend_env": {"PATH": "{PATH};/anaconda/bin/"}
(and some other variants) it does not work either.
Anyway, I am sure the solution is fairly simple, but I am new to Sublime, and at this stage I do not know what or where I have to add PATH
or ENV
variables.