【问题标题】:Linking/updating Mac OS X python/python3 in terminal在终端中链接/更新 Mac OS X python/python3
【发布时间】:2017-05-23 04:26:14
【问题描述】:

我一直在尝试通过最初安装 Homebrew 在 OS X 上更新 python3(当前设置为 python 3.5.1):

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后安装python:

$ brew install python

在尝试将我的 brew 安装的 python 作为我的默认链接之前,我运行:

$ brew info python3
...
/usr/local/Cellar/python3/3.6.1 
...
$ python3 -V
Python 3.5.1

所以现在我执行取消链接和链接:

$ brew unlink python3 && brew link python3

然后我跑了:

$ python3 -V
Python 3.5.1

Python3 仍然默认使用随附的 3.5.1 python。我查看了整个堆栈溢出似乎找不到解决方案或可能发生这种情况的原因。任何帮助都会很棒,谢谢!

更新: 我猜当我安装 python 3.6.1 时,它的命令设置为 python3.6:

$ python3.6 -V
Python 3.6.1

【问题讨论】:

  • which python3 的输出是什么?
  • 哦,运行brew doctor 也可能有所帮助。

标签: python macos installation homebrew symlink


【解决方案1】:

我会卸载当前版本的 Python 并仅通过以下方式获取最新版本

$ brew uninstall your_python_program
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install python3

或者通过一个非常棒的 Python 包from here。 Pyenv 将允许您并排运行不同的 Python 版本。

【讨论】:

    猜你喜欢
    • 2010-10-29
    • 1970-01-01
    • 2011-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-05
    • 2016-01-10
    • 1970-01-01
    相关资源
    最近更新 更多