[英]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.