Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using conda environment in IPython interactive shell

I am trying to use the interactive shell of IPython within my conda env and am having issues. The steps I take are:

source activate myenv
conda install ipython
ipython

When I am in ipython interactive shell, it calls python from the anaconda root bin. (~/anaconda2/bin')

Is there anything I can do to change the python path to ~/anaconda2/envs/myenv/bin and import packages from myenv?

I see few solutions to making env work in jupyter when I search the web, but no answer on making it work on the interactive shell.

like image 874
unknown_jy Avatar asked Jun 21 '17 17:06

unknown_jy


1 Answers

This is likely due to your $PATH variable being messed up.

THe easiest way to make sure you get IPython from within an env is to use $ python -m IPython <rest of the options> to start IPython. This works for many of the Python installable application; like pytest, pip and other.

like image 80
Matt Avatar answered Sep 25 '22 19:09

Matt