問題描述
我在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
我該如何解決這個問題?
How can I resolve this issue?
更新
我在 ~/.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 deactivate
.)
(If you have activated multiple environments, you may need to run conda deactivate
multiple times.)
這篇關于為什么 Conda 激活環境后無法調用正確的 Python 版本?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!