Switch between Python 3.x and 3.y through anaconda

2019-08-18 05:43发布

问题:

I have a HDP cluster and I'm working with couple data scientist, we're working on Python 3.5 (anaconda3) and I would switch to the new Python version 3.6 while keeping the previous version which is 3.5

My questions:

Is that possible having 2 version of Python like 3.5 and 3.6 through anaconda?

if that true, how can I switch between those two version?

回答1:

You have to create two environments:

conda create -n py35 python=3.5
conda create -n py36 python=3.6

then you can change to the desired environment using

source activate py35

or source activate py36

you can then pip instal and use python specific to that environment

To leave an environment use

source deactivate

read up on it in the anaconda documentation

Note: on windows, use an anaconda prompt and leave out the source