为什么Conda激活环境后无法调用正确的Python版本? [英] Why Conda cannot call correct Python version after activating the environment?
本文介绍了为什么Conda激活环境后无法调用正确的Python版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Linux下具有以下conda环境:
I have the following conda environment under Linux:
$ conda info -e
# conda environments:
#
py33 /u21/coyotito/.anaconda/envs/py33
root * /u21/coyotito/.anaconda
然后使用以下命令创建py33
:
And py33
is created with this command:
$ conda create -n py33 python=3.3 anaconda
问题是,当我激活py33
时,它仍然无法调用Python版本3.3.
The problem is when I activate py33
it still cannot call Python version 3.3.
[coyotito@pearl ~]$ source activate py33
(coyotito)[coyotito@pearl ~]$ python --version
Python 2.7.10 :: Anaconda 2.1.0 (64-bit)
(coyotito)[coyotito@pearl ~]$ conda info -e
# conda environments:
#
py33 /u21/coyotito/.anaconda/envs/py33
root * /u21/coyotito/.anaconda
也就是说,它仍在调用旧的python.另请注意,括号下的提示不是(py33)
.
Namely it still calling old python. Notice also that the prompt under bracket is not (py33)
.
(coyotito)[coyotito@pearl ~]$ which python
~/.anaconda/bin/python
在新环境中代替python:
Instead of python in new environment:
~/.anaconda/envs/py33/bin/python3.3
如何解决此问题?
更新
我在~/.bash_profile
中的PATH环境如下:
My PATH environment in ~/.bash_profile
looks like this:
export PATH=$HOME/.anaconda/bin:$PATH
推荐答案
我遇到了完全相同的问题.不知道我是如何陷入困境的,但是我用一个简单的方法解决了这个问题:
I had the exact same problem. Not sure what I did to get into that mess, but I solved it with a simple:
conda deactivate
conda activate foo_env
这篇关于为什么Conda激活环境后无法调用正确的Python版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文