当前位置: 首页 > 面试题库 >

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

叶炜
2023-03-14
问题内容

。已记录的重新安装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公式。这些包括awscliletsencrypt,PRsshuttle例如

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效果也不佳。

重新安装awsclibrew 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

问题答案:

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

  1. 链接的brew extract链接确实没有帮助,您需要在此处查找有关如何从提取的资源中进行自己的点击的答案。
  2. 链接的提交:028f11f9e错误,因为它包含已删除的文件。
  3. 由于包名称中的@,该brew extract命令甚至无法正常工作。

但是,该解决方案非常简单,您只需下载最新的已知提交并从该文件进行安装:

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 2和3之间来回切换。如何使用Homebrew做到这一点,因为我不想弄乱路径并遇到麻烦。现在,我通过Homebrew安装了2.7。 问题答案: 我会用pyenv您可以安装它: 要在您的Bash shell中启用pyenv,您需要运行: 要在启动时自动为Bash执行此操作,请将该行添加到您的中。1个 用法: 安装并激活pyenv后,您可以安装不同版本的python

  • 我正试图从自制安装hdf5库。在终端中运行将返回以下错误消息: ==>搜索类似名称的公式... 错误:找不到类似名称的公式。 错误:没有可用的公式或名称为“HDF5”的桶。 ==>搜索以前删除的公式(在上个月)... 错误:找不到以前删除的公式。 ==>在GitHub上搜索抽头... 错误:抽头中找不到公式。 我是在mac上运行的Mojave 10.14.6版本。下载hdf5库的下一步应该是什么?

  • 当我试图运行python代码时,OpenCV中出现了一个错误。我试着跑步 但是我得到了这个错误。 OpenCV错误:未指定的错误(该函数未实现。使用Windows、GTK 2.x或Carbon支持重建库。如果您在Ubuntu或Debian上,请安装libgtk2.0-dev和pkg config,然后重新运行cmake或configure脚本),位于cvShowImage、file/home/pa

  • 如果我写,酿造医生 帮帮我....我想用自制软件下载节点,我想解决所有警告...........

  • 我一直在使用openssl和brewpython@2问题,这里已经解释过了(未解决)。重新安装Python和openssl的文档解决方法不起作用,所以我决定卸载并重新安装Python。 问题是,当您尝试使用brew安装Python 2时,您会收到以下消息: 不幸的是,我仍然有许多取决于Brew python@2的酿造配方。这些包括 我不知道如何使用他们记录的这个< code>brew extrac

  • 我刚刚升级到优胜美地。我使用的是Apache 2.2,但升级包括2.4。在经历了一些配置噩梦之后,我最终使用Homebrew重新安装了2.4。我有它大部分配置。但是,当我使用PHP的旧httpd.conf设置时,我得到以下错误: 未找到符号:_unixd_config\n引用自:/usr/local/opt/php55/libexec/apache2/libphp5。因此\n应在:/usr/loc