简体   繁体   English

如何在 macOS 12.3+ 上安装 Python 2

[英]How to install Python 2 on macOS 12.3+

macOS 12.3 update drops Python 2 and replaces it with version 3: macOS 12.3 更新删除 Python 2 并将其替换为版本 3:

https://developer.apple.com/documentation/macos-release-notes/macos-12_3-release-notes https://developer.apple.com/documentation/macos-release-notes/macos-12_3-release-notes

Python Deprecations Python 2.7 was removed from macOS in this update. Python 弃用 Python 在此更新中从 macOS 中删除了 2.7。 Developers should use Python 3 or an alternative language instead.开发人员应改用 Python 3 或其他语言。 (39795874) (39795874)

I understand we need to migrate to version 3, but in the meantime we still need version 2. Homebrew does not seem to have it anymore:我知道我们需要迁移到版本 3,但与此同时我们仍然需要版本 2。Homebrew 似乎不再有它了:

brew install python@2.7
Warning: No available formula with the name "python@2.7". Did you mean python@3.7, python@3.9, python@3.8, python@3.10 or python-yq?

brew install python2
Warning: No available formula with the name "python2". Did you mean ipython, bpython, jython or cython?

What gives?是什么赋予了?

You can get any Python release, including the last Python 2, from the official download site:您可以从官方下载站点获取任何 Python 版本,包括最后一个 Python 2:

https://www.python.org/downloads/release/python-2718/macOS 64-bit installer https://www.python.org/downloads/release/python-2718/macOS 64 位安装程序

A bit more relevant information.多一点相关信息。 It was removed due to the fact that macOS remove the support of python2 , and there is an open issue to remove all the python2 formulae as well.它被删除是因为macOS 删除了对 python2 的支持,并且还有一个未解决的问题来删除所有 python2 公式。

Instead of using python official installer, I would suggest using pyenv , which is easier to manage multiple python versions in your local.我建议使用pyenv而不是使用 python 官方安装程序,这样更容易在本地管理多个 python 版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 OS 12.3+ 的新 macbook pro M1 上使用 pyenv 安装 python 3.7.6 时出错 - Error installing python 3.7.6 using pyenv on new macbook pro M1 in OS 12.3+ 在 macOS 12.3 Monterey 上安装 Python 3.8.10 时出现问题 - Issues installing Python 3.8.10 on macOS 12.3 Monterey Python 乌龟图形在 MacOS Mojave 12.3 上不工作 - Python turtle graphics are not working on MacOS Mojave 12.3 无法在 macOS Monterey 12.3 上安装 psycopg2-binary - Can't install psycopg2-binary on macOS Monterey 12.3 如何在 MacOS 上的 python 中安装 xgboost? - How to install xgboost in python on MacOS? 如何在 macOS 上安装 dbus-python? - How to install dbus-python on macOS? 如何在 macOS Monterey 上安装不同版本的 Python - How to install a different version of Python on macOS Monterey 如何修复“zsh:找不到命令:python”错误? (macOS Monterey 12.3、Python 3.10、Atom IDE 和 atom-python-run 0.9.7) - How can I fix the "zsh: command not found: python" error? (macOS Monterey 12.3, Python 3.10, Atom IDE, and atom-python-run 0.9.7) 如何在MacOS上为python27安装jsonrpc - how install jsonrpc on macos for python27 如何在opensuse 12.3上启用对当前python 2.7.3的ssl支持? - how to enable the ssl support for the current python 2.7.3 on opensuse 12.3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM