从终端调用时使用默认的Python而不是Anaconda安装 [英] Use Default Python Rather than Anaconda Installation When Called from the Terminal
问题描述
我最近安装了蟒蛇的蟒蛇版本.现在,当我在终端中键入python
时,它将打开anonconda发行版而不是默认发行版.如何在Linux(ubuntu 12.04)中使用默认版本的命令python
?
I recently installed the anaconda version of python. Now when I type python
into the terminal it opens the anonconda distribution rather than the default distribution. How do I get it to use the default version for the command python
in linux (ubuntu 12.04)?
推荐答案
anaconda将路径添加到.bashrc
,以便首先找到它,您可以将默认python的路径添加到.bashrc
或删除该路径.如果您不想使用anaconda.
anaconda adds the path to your .bashrc
so it is found first, you can add the path to your default python to .bashrc
or remove the path to anaconda if you don't want to use it.
您还可以在bash中使用完整路径/usr/bin/python
来使用默认的python解释器.
You can also use the full path /usr/bin/python
in bash to use the default python interpreter.
如果您将.bashrc
文件保持不变,则使用python
运行的任何命令都将使用anaconda解释器,如果需要,还可以为每个解释器使用alias
.
If you leave your .bashrc
file as is, any command you run using python
will use the anaconda interpreter, if you want you could also use an alias
for each interpreter.
您将在.bashrc
文件中看到类似export PATH=$HOME/anaconda/bin:$PATH
的内容.
You will see something like export PATH=$HOME/anaconda/bin:$PATH
in your .bashrc
file.
因此,基本上,如果您想将anaconda用作日常主要的解释程序,请使用默认Python的完整路径或创建alias
,如果需要,请以其他方式删除export PATH=...
.从bashrc
开始,并使用完整路径访问anaconda python解释器.
So basically if you want to use anaconda as your main everyday interpreter use the full path to your default python or create an alias
, if you want it the other way around remove the export PATH=...
. from bashrc
and use full path to anaconda python interpreter.
这篇关于从终端调用时使用默认的Python而不是Anaconda安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!