gpt4 book ai didi

python - 如何从 Homebrew 重新安装 python@2?

转载 作者:行者123 更新时间:2023-12-01 07:21:57 25 4
gpt4 key购买 nike

我在使用 brew 时遇到了 openssl 和 python@2 问题,which have explained here (unresolved) .重新安装 Python 和 openssl 的文档化解决方法不起作用,所以我决定卸载并重新安装 Python。
问题是,当您尝试使用 brew 安装 Python 2 时,您会收到以下消息:

brew install python@2
Error: No available formula with the name "python@2"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow

python@2 was deleted from homebrew/core in commit 028f11f9e:
python@2: delete (https://github.com/Homebrew/homebrew-core/issues/49796)
EOL 1 January 2020.
We gave it 1 month more to live so that people had time to migrate.
All in all, developers had 11 years to do their migration.
You can use the `brew extract` command and maintain python@2 in your own
tap if necessary:
https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap

To show the formula before removal run:
git -C "$(brew --repo homebrew/core)" show 028f11f9e^:Formula/python@2.rb

If you still use this formula consider creating your own tap:
https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap
不幸的是,我仍然有许多依赖于 Brew 的 python@2 的 brew 公式。其中包括 awscli , letsencrypt , 公关 sshuttle例如
aws
zsh: /usr/local/bin/aws: bad interpreter: /usr/local/opt/python@2/bin/python2.7: no such file or directory
我不知道如何使用这个 brew extract他们记录了重新安装 Python@2 的命令。它需要一个公式和一个水龙头。我想公式是 python@2 .我不确定水龙头需要是什么。
另外重新安装水龙头,例如 awsletsencrypt也不能很好地工作。
重装后 awscli ( brew reinstall awscli ),运行 aws 命令仍然会出错。
aws
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
if x is 0 or x is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
if x is 0 or x is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif y is 0 or y is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif y is 0 or y is 1:
/usr/local/Cellar/awscli/2.0.0/libexec/lib/python3.8/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="?
if original_result is 0:
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

aws help
aws <command> help
aws <command> <subcommand> help
aws: error: the following arguments are required: command

最佳答案

似乎 Homebrew 软件的工作人员真的尽可能地在 macOS 上使用 Python 2.7 变得尽可能困难。

  • 已链接 brew extract链接真的没有帮助,您需要在此处寻找有关如何从提取的源中制作自己的水龙头的答案。
  • 链接提交:028f11f9e 是错误的,因为它包含已删除的文件。
  • brew extract命令 doesn't even work correctly ,因为包名中有@。

  • 解决方案非常简单,您只需要下载最新的已知提交并从该文件安装:
    cd ~
    wget https://raw.githubusercontent.com/Homebrew/homebrew-core/86a44a0a552c673a05f11018459c9f5faae3becc/Formula/python@2.rb
    brew install python@2.rb
    rm python@2.rb
    可能会有关于“不稳定”的警告,我不明白这是因为 Git 历史记录中的提交尽可能稳定。

    关于python - 如何从 Homebrew 重新安装 python@2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60298514/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com