从终端调用时,使用默认的Python而不是Anaconda安装 [英] Use the default Python rather than the Anaconda installation when called from the terminal

查看:72
本文介绍了从终端调用时,使用默认的Python而不是Anaconda安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了Python的Anaconda版本.现在,当我在终端中键入 python 时,它将打开Anaconda发行版,而不是默认发行版.如何在Linux上为命令 python 使用默认版本(

I recently installed the Anaconda version of Python. Now when I type python into the terminal it opens the Anaconda distribution rather than the default distribution. How do I get it to use the default version for the command python on Linux (Ubuntu 12.04 (Precise Pangolin))?

推荐答案

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 instance 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆