在 M1 MacBook Pro 中安装 libjpeg 时如何修复错误?

How to fix error when installing libjpeg in M1 MacBook Pro?

我正在使用命令在我的 arm64 终端中安装 libjpeg

brew install libjpeg

但是它给我这个错误:

Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
  https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
  brew bundle dump

这是什么意思?以及如何解决? 提前谢谢大家。

运行 终端中的这个命令:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

在终端 运行 中:

touch .zshrc

打开它用TextEdit编辑(它是一个隐藏文件,所以shift + command + . 将取消隐藏它)

在 .zshrc 的末尾添加这一行:

export PATH=/opt/homebrew/bin:$PATH

运行 在终端中使其可用:

source ~/.zshrc

检查以确保其有效:

brew help