0

I know that a very similar question has been asked there, but I think my issue is different.

I have just installed Anaconda2 following the Anaconda documentation steps (downloading and executing the sh script), then re launching the shell. I had a previously installed python version on /usr/bin, which was version 3.4.3. I have Ubuntu 14.04.5 LTS.

I have created an environment which should run on python 2.7

conda create --name myenvpy2 python=2
source activate myenvpy2

If I look at my path, I have the following

echo $PATH
/home/gvo/anaconda2/envs/myenvpy2/bin:/home/gvo/anaconda2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:...

On /home/gvo/anaconda2/envs/myenvpy2/bin I have the correct version of python

ls -l
python -> python2.7

And

./python --version
Python 2.7.12 :: Continuum Analytics, Inc.

Therefore, when running simply python I would expect the same result, since this folder contains a python and is the first of the $PATH variable. However :

python --version
Python 3.4.3

This effectively seems to be the /usr/bin version of Python

>>> import sys
>>> print (sys.executable)
/usr/bin/python3

I don't understand why, despite a python can be found in the first folder of the path, it goes through another version of Python, found in a later folder.

Please note that with a python=3 environment created and sourced, it indeed uses the correct python version installed by anaconda, which adds a lot to my confusion.

python --version
Python 3.5.2 :: Continuum Analytics, Inc.

Do you have any clue?

gvo
  • 101
  • 3

0 Answers0