Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python version does not change when creating conda environment with different python version

Tags:

python

conda

I currently have python3 set as my default python version but I'd like to be able to switch back to python2 for certain things so I created a conda environment with the following command:

conda create -n py2 python=2.7

and then activated it with:

source activate py2

but when I do:

python --version

I still get

Python 3.6.8

What am I doing wrong here? I'm trying to download a conda package this is only python2 compatible but despite being in a python2 environment, it keeps telling me my python version is incompatible.

like image 215
nickeener Avatar asked Aug 03 '19 18:08

nickeener


People also ask

How do I install python 3.9 on Anaconda?

So, how do I install python 3.9 in a conda env with all functionalities like pip working? This can be installed via conda with the command conda install -c anaconda python=3.9 as per anaconda.org/anaconda/python. running conda update --all may resolve some dependency failures.


1 Answers

You might be running into the issue where you have multiple environments on top of one another.

Try running:

conda deactivate

multiple times in order to exit from all of the environments. Then run:

condo activate py2
like image 169
Andrew Lyubovsky Avatar answered Oct 15 '22 15:10

Andrew Lyubovsky