【问题标题】:Python How to change default version back from python 3.5 to python 2.7Python 如何将默认版本从 python 3.5 更改回 python 2.7
【发布时间】:2016-02-27 23:54:37
【问题描述】:

最近,我刚刚为python3安装了anaconda3,效果很好。但是后来我发现我的python默认版本也被修改成了python3.5。当我在终端中输入“python”时,它看起来像这样

Python 3.5.1 |Anaconda 2.4.1 (x86_64)| (default, Dec  7 2015, 11:24:55)

所以我去查看我的 bash_profile,发现为什么它被更改为 python3.5:

# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

# added by Anaconda3 2.4.1 installer
export PATH="//anaconda/bin:$PATH"

# added by Anaconda3 2.4.1 installer
export PATH="/Users/chengluli/anaconda/bin:$PATH"

# added by Anaconda3 2.4.1 installer
export PATH="/Users/chengluli/anaconda/bin:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
eval "$(rbenv init -)"

在我评论了所有与python3.5和anaconda3相关的文字之后。默认改为python2.7。

但是,我现在遇到的问题是 anaconda3 无法正常工作。当我输入 ipython notebook 时,出现错误。

所以我想知道如何在 anaconda3 正常工作的同时更改默认 python 版本?或者anaconda3只有在默认为python3.5时才能工作。所以我需要改用 anaconda2 吗?提前致谢!

【问题讨论】:

    标签: python terminal anaconda


    【解决方案1】:

    您可以更改当前用户的别名或创建新的符号链接以使其在系统范围内。

    更多信息和 Debian 示例可以在这里找到https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux

    【讨论】:

      【解决方案2】:

      请下载 Anaconda2,它使用 Python 2.7。

      当您删除 anaconda 路径 .bashrc 时,您从系统路径中删除了 ipython 和所有其他二进制文件。它们仍在您的系统上,但您无法通过键入 ipython 来运行它们,您必须从它们的位置 ./anaconda3/bin/ipython 或同等位置运行它们

      【讨论】:

        猜你喜欢
        • 2017-03-26
        • 2020-11-19
        • 2011-08-16
        • 1970-01-01
        • 1970-01-01
        • 2011-03-21
        • 2018-04-10
        • 1970-01-01
        • 2017-12-13
        相关资源
        最近更新 更多