简体   繁体   中英

ipython uses wrong python version with anaconda

After activating my anaconda Python 3.6 environment with

source activate py36

if I type

python

I go into python 3.6, as expected. But if I type

ipython

I go into an ipython environment based python 3.5.5, which is the same python version I get using

source activate base

and then

python

How can I get into an ipython environment using my anaconda-supplied python 3.6 interpreter? I have updated my anaconda environment with

conda update anaconda

and

conda update conda

Doing so does not help.

EDIT:

I hadn't realized that I had to install ipython separately for the python 3.6 environment; I'd thought it was a default part of anaconda. So

conda install ipython

after

source activate py36

did the trick. It doesn't seem optimal that after activating a particular environment, ipython may bring up a completely different anaconda-based environment. I'd prefer it to simply cause a "command not found" error. Bringing up the wrong environment without making it very obvious that that is happening could lead to confusion or problems.

I hadn't realized that I had to install ipython separately for the python 3.6 environment; I'd thought it was a default part of anaconda. So

conda install ipython

after

source activate py36

did the trick.

Have you done hash -r since entering the conda environment? Bash can cache paths to executables, so sometimes it doesn't use the one reported by which. Running hash -r resets the cache

Maybe you need also to update ipython conda update ipython

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM