简体   繁体   English

为什么我 conda 使用 python3.7 激活 env,但 python 版本仍然是 python3.5?

[英]Why I conda activate env with python3.7, but python version still is python3.5?

I installed Miniconda3 on Ubuntu 16, and used the command我在 Ubuntu 16 上安装了 Miniconda3,并使用了命令

conda create -n py37 python=3.7

to create an env, and use command conda activate py37 to activate the env.创建一个环境,并使用命令conda activate py37来激活环境。 But when I use command python --version to check my Python version, it show the version of Python is 3.5.2.但是当我使用命令python --version检查我的 Python 版本时,它显示 Python 的版本是 3.5.2。 So I try to create another env with Python 2.7, but after I activate this env, the version of Python is still 3.5.2.所以我尝试用 Python 2.7 创建另一个 env,但是在我激活这个 env 之后,Python 的版本仍然是 3.5.2。

Debugging调试

When I type type python , it shows python is aliased to '/usr/bin/python3.5.2' .当我键入type python时,它显示python别名为'/usr/bin/python3.5.2' Then by using the command to edit the .bashrc file, I found that there is a line of statement然后通过使用命令编辑.bashrc文件,发现有一行语句

alias python='/usr/bin/python3.5.2'

so I tried to change to所以我试图改变为

alias python='/home/vagrant/miniconda3/envs/django-judge/bin/python'

where the Python version of the env is 3.7.其中 env 的 Python 版本是 3.7。 Then when I type type python again, it returns that python is aliased to '/home/vagrant/miniconda3/envs/django-judge/bin/python' .然后,当我再次type python时,它返回 python 别名为'/home/vagrant/miniconda3/envs/django-judge/bin/python' But now, under all envs, the Python version has become Python 3.7.但是现在,在所有环境下,Python 版本已变为 Python 3.7。

Remove the alias altogether: it is not compatible with Conda to alias python .完全删除别名:它与 Conda 不兼容别名python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM