How to use both versions of anaconda on linux?

Asked

Viewed 941 times

1

Good afternoon guys, I’m studying python for projects and I was recommended to use the anaconda package. I am a linux user (Ubuntu) and have therefore installed the two packages on my system. Currently in the college project, we are working with data analysis, however I can not make use of the anaconda 2 package (with version 2.7). Only version 3 has path inscribed in the script "bash.rc". I would like to use both versions as we are dealing with both versions of the project and would not like to use "virtual machines, or mv_env" for installation of version 2.7. So I ask is there any way? I’m on hold, guys.

PS: Do not allow the anaconda 2 package to export the path in the bash script, for priority use the python 3.X version.

1 answer

1

In reality you don’t need to use two versions of anaconda (and not this related to bashrc, bashrc just indicates the location of the installation), install only one version and you can have as many environments as you need, for example, download one of these versions and install. Note that the difference is that one comes with python 2.7 and the other with python 3.6 as default (root). I always install the 3.6.

If you installed the one that comes with pyathon 3.6 and run the command to see the (python) version, you get:

python --version
Python 3.6.0 :: Anaconda 4.3.1 (64-bit)

Let’s say you downloaded 3.6 and need to install python 2.7 for a specific project, then do:

conda create -n py27 python=2.7

With this we create an env called py27. To activate it do:

$ source activate py27
(py27) sidon@sidon....

Note that after activating the new environment your command prompt has changed, adding the name of the parentheses in the beginning "(py27)".

See now (after active environment) what the command to show the version gets:

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

Once active, qq thing q vc install (with Pip for example), will be installed in that environment.

Let’s assume that a project appears where it is mandatory to work with python 3.4, so just do:

conda create -n py34 python=3.4

And so you have a new env. To list all your envs, do:

$ conda-env list
# conda environments:
#
autopart                 /home/sidon/anaconda3/envs/autopart
eztables                 /home/sidon/anaconda3/envs/eztables
gestauto                 /home/sidon/anaconda3/envs/gestauto
llabs                    /home/sidon/anaconda3/envs/llabs
material                 /home/sidon/anaconda3/envs/material
olist                    /home/sidon/anaconda3/envs/olist
py27                  *  /home/sidon/anaconda3/envs/py27
scrum                    /home/sidon/anaconda3/envs/scrum
root                     /home

Aztec indicates which env is active. To disable the current env and go back to root, do:

source deactivate

Browser other questions tagged

You are not signed in. Login or sign up in order to post.