在安装Python 2.7.9而不是最新的2.7.10的情况下,以前我可以brew versions python通过在brew中提交SHA来简单地使用和查看所有Python公式版本,然后将其检出以安装特定版本。这是brew versions python输出示例:
brew versions python
$ brew versions python Warning: brew-versions is unsupported and will be removed soon. You should use the homebrew-versions tap instead: https://github.com/Homebrew/homebrew-versions 2.7.9 git checkout 667284f /usr/local/Library/Formula/python.rb 2.7.8 git checkout f26ca5c /usr/local/Library/Formula/python.rb 2.7.7 git checkout d48206e /usr/local/Library/Formula/python.rb 2.7.6 git checkout 3c64184 /usr/local/Library/Formula/python.rb 2.7.5 git checkout a04b443 /usr/local/Library/Formula/python.rb 2.7.3 git checkout 865f763 /usr/local/Library/Formula/python.rb 2.7.4 git checkout 280581d /usr/local/Library/Formula/python.rb 2.7.2 git checkout 97c6869 /usr/local/Library/Formula/python.rb 2.7.1 git checkout 83ed494 /usr/local/Library/Formula/python.rb 2.7 git checkout 1bf3552 /usr/local/Library/Formula/python.rb 2.6.5 git checkout acd49f7 /usr/local/Library/Formula/python.rb 2.6.4 git checkout 843bff9 /usr/local/Library/Formula/python.rb 2.6.3 git checkout 5c6cc64 /usr/local/Library/Formula/python.rb
但是最新版本的brew已经取消了对它的versions支持,而且我不了解如何使用https://github.com/Homebrew/homebrew- versions安装以前的Python 。如何实际安装Python 2.7.9而不是较新的2.7.10?
versions
我想知道如何使用homebrew-versions而不是更简单的方法brew versions。
homebrew-versions
brew versions
这样,brew versions我就可以轻松地从该特定公式中看到所有版本(请看一下上面通过吐出的Python版本brew versions python)。从doc来看,没有明确的方法可以达到相同的结果brew versions python。
homebrew-versions曾经是最简单的方法,但是homebrew-versions已被弃用,并且在当前版本的homebrew中不再可用。
要查找易于使用的版本,请使用以下命令:
brew search python
列出所有可用的python软件包,这些软件包将显示类似的旧版本python@2,然后您可以使用以下命令进行安装:
python@2
brew install python@2
如果您已经安装了较旧版本的公式,但尚未删除它,则可以使用brew命令简单地切换符号链接以引用它。
brew switch python 2.7.9
此命令将您切换到2.7.9版
brew switch python 2.7.10
这会将您切换回2.7.10版
如果您的系统上仍然没有较旧的版本,则可以尝试另一种方法,但是它更困难,而且几乎肯定不受Homebrew支持,因此,如果遇到问题,则可能无法依靠他们的帮助。
https://github.com/Homebrew/homebrew- core/commits/master/Formul/<formula>.rb应该带您到该公式的提交历史记录。对于安装python 2.7.9的示例,请执行以下操作:
https://github.com/Homebrew/homebrew- core/commits/master/Formul/<formula>.rb
https://github.com/Homebrew/homebrew-core/commits/master/Formula/python.rb
1681e19
git checkout 1681e19 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/python.rb
从这一点开始,您将执行通常使用旧版本方法安装旧版本python的所有操作。这似乎是旧方法所做的全部。