Brew-重新安装python @ 2 [英] Brew - reinstalling python@2

查看:2042
本文介绍了Brew-重新安装python @ 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在用brew时遇到openssl和python @ 2的问题,

I have been having issues with openssl and python@2 with brew, which have explained here (unresolved). The documented workaround to reinstall Python and openssl was not working, so I decided I would uninstall and reinstall Python.

问题是,当您尝试通过brew安装Python 2时,会收到以下消息:

The problem is, when you try to install Python 2 with brew, you receive this message:

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公式.例如,包括awscliletsencrypt,pr sshuttle

Unfortunately I still have a number of brew formulas that depends on Brew's python@2. Those include awscli, letsencrypt, pr sshuttle for example

aws
zsh: /usr/local/bin/aws: bad interpreter: /usr/local/opt/python@2/bin/python2.7: no such file or directory

我不知道如何使用他们记录的重新安装Python @ 2的brew extract命令.它需要一个公式和一个水龙头.我想公式是python@2.我不确定水龙头将是什么.

I don't know how to use this brew extract command they documented to reinstall Python@2. It needs a formula and a tap. I imagine the formula would be python@2. I'm not sure what the tap would need to be.

另外重新安装诸如awsletsencrypt的水龙头也不能很好地工作.

Additionally reinstalling the taps such as aws or letsencrypt is not working very well either.

重新安装awscli(brew reinstall awscli)后,运行aws命令仍然会出错.

After reinstalling awscli (brew reinstall awscli), running aws commands still gives errors.

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

推荐答案

看来,自制软件的工作人员确实使得尽可能地在macOS上使用Python 2.7变得更加困难.

It seems that the homebrew staff really makes it as hard as possible to use Python 2.7 on macOS as they can.

  1. 链接的brew extract链接确实没有帮助,您需要在此处寻找有关如何从提取的资源中进行自己点击的答案.
  2. 链接的提交:028f11f9e错误,因为它包含已删除的文件.
  3. brew extract命令甚至无法正常工作,因为@在包名称中.
  1. The linked brew extract link is really not helpful, you need to look for answers here about how to make your own tap from extracted sources.
  2. The linked commit: 028f11f9e is wrong, as it contains the already deleted file.
  3. The brew extract command doesn't even work correctly, because of the @ in the package name.

该解决方案非常简单,您只需要从已知的最新提交进行安装:

The solution is very simple though, you just need to install from the latest known commit:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/86a44a0a552c673a05f11018459c9f5faae3becc/Formula/python@2.rb

有人警告说这是不稳定"的,我不理解,因为在Git历史记录中的提交是尽可能稳定的.

There is a warning about this being "unstable", which I don't understand as a commit in a Git history is as stable as you can get.

这篇关于Brew-重新安装python @ 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆