通过 brew 安装 azure cli 在 mac m1 中不起作用

Install azure cli via brew not working in mac m1

我一直在尝试在新 mac m1 中安装 azure cli。但它失败了。我收到以下错误

brew reinstall azure-cli
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/manifests/2.22.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/azure-cli/blobs/sha256:1980c967
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs
######################################################################## 100.0%
==> Reinstalling azure-cli 
==> Pouring azure-cli--2.22.1.arm64_big_sur.bottle.tar.gz
  /opt/homebrew/Cellar/azure-cli/2.22.1: 19,449 files, 329.3MB

浇完就停了。我也尝试使用 pip3 安装,我可以成功安装,但是当我输入“az”命令时,出现以下错误

/opt/homebrew/bin/az: line 2: 64784 Killed: 9               AZ_INSTALLER=HOMEBREW /opt/homebrew/Cellar/azure-cli/2.22.1/libexec/bin/python -m azure.cli "$@"

如评论中所述:我的 python3 不是通过 brew 安装的。所以首先卸载了 brew 和 python3。然后再次安装 brew(在此之前确保 Rosetta 2 正在运行)。然后尝试酿造医生。出现错误说 /usr/... 然后,我删除了那些文件。一旦成功 removed/deleted brew doctor 将 运行 正常。