【问题标题】:Problem in installing and configuring latest python 3.8 on MacOS在 MacOS 上安装和配置最新的 python 3.8 时出现问题
【发布时间】:2019-12-02 01:25:33
【问题描述】:

我一直在尝试通过自制软件在 MacOS 上安装 Python 3.8,但最终得到了许多版本的 Python。

$ which python3
$ /Library/Frameworks/Python.framework/Versions/3.6/bin/python3

$ cd /Library/Frameworks/Python.framework/Versions
$ ls
$ 3.6   3.8

如何修复它以使 3.8 成为默认的 python 版本?

【问题讨论】:

  • 在 Linux 上我有命令 python3python3.6python3.7python3.8,我不必设置默认版本,因为我可以使用 python3.8。此外系统使用 Python 来运行一些元素。如果我要更改默认版本,那么系统将无法运行。

标签: python macos homebrew


【解决方案1】:

据我所知,目前我们仍在努力迁移到 Python 3.8(太多的 Homebrew 公式依赖项和 Jenkins CI 经常耗尽磁盘空间)。

这里是大型问题跟踪器:Github python 3.8 migration issue

目前,我建议使用pyenv,我自己也用它来管理多个python版本进行开发。

这是你需要做的:

  • brew install pyenv
  • pyenv init
  • eval "$(pyenv init -)" # 确保 echo 'eval "$(pyenv init -)"' > ~/.bash_profile 用于未来的 shell 会话。
  • pyenv install 3.8.0
  • pyenv global 3.8.0

然后你就可以走了。

【讨论】:

  • 对于 macOS Catalina 版本 10.15.+,您可以将 eval "$(pyenv init -)" 附加到 ~/.zshrc 而不是 ~/.bash_profile。由于 bash 不再是默认 shell。
猜你喜欢
  • 1970-01-01
  • 2022-08-12
  • 2020-11-10
  • 2018-05-17
  • 1970-01-01
  • 2021-04-12
  • 2018-08-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多