Why can't I change my python version
0
0
Entering edit mode
2.6 years ago
LeeLee ▴ 10

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 • 1.1k views
ADD COMMENT
0
Entering edit mode

Did you activate the enviromnent?

ADD REPLY
0
Entering edit mode

Yes I activated

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

/home/leelee/miniconda3/envs/clear/bin/python
/home/leelee/miniconda3/bin/python
ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1433 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6