This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Why can't I change my python version

I am using some bioinformatics software that requires a python2 environment. I use conda to create a new environment and specify the python version as 2.7.18, but when I type 'python' I find that the python version is 3.9.5. I use the 'which python'code, and ls -l the link, and get return

> lrwxrwxrwx 1 leelee leelee 9 9月  22 20:06 /home/leelee/miniconda3/envs/clear2/bin/python -> python2.7

I type 'python2.7' and got the version I wanted. But it is still 3.9.5 when type 'python'. I am very confused about this, how can I solve this problem.

python

Did you activate the enviromnent?

What is the output of which -a python with and without the environment activated?

When without activated return /home/leelee/miniconda3/bin/python,when activate return

/home/leelee/miniconda3/envs/clear/bin/python
/home/leelee/miniconda3/bin/python

Looks like something is wrong with your environments then, as the binary in use first when your environment is activated is .../envs/clear/bin/python, but the path you mentioned in the first post is .../envs/clear2/bin/python

There is a 2 in there which is presumably 2 different environments. Check if /home/leelee/miniconda3/envs/clear/bin/python is a link to a different binary.

I suspect the python you think you're calling (and is 2.7) isn't the one you actually are calling.

In fact, clear2 is an environment for me to test. Both clear and clear2 environments should be python2.7. But after relinking the python of the clear environment, I suddenly got python2.7, maybe I really confused it, thank you very much for your reply

0 answers

No answers yet.

Log in to answer this question.