首页 > 解决方案 > 在 M1 MacBook Pro 中安装 libjpeg 时如何修复错误?

问题描述

我正在使用命令在 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

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

标签: pythonmacosterminalhomebrewarm64

解决方案


在终端中运行此命令:

/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

推荐阅读