mac中使用brew install opencv出现错误

首先查看brew update升级信息

brew update --verbose --force

fatal: Needed a single revision

之前修改过源,导致出现416,git更新失败.

重置所有源

重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

 

brew update --verbose --force 

继续执行

Updating /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask...
fatal: Needed a single revision

需要进入到 /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask

git pull 
From https://github.com/Caskroom/homebrew-cask
 * branch                  HEAD       -> FETCH_HEAD

重新执行 brew update 恢复正常.

继续brew search opencv2

正常找出2个库.

brew  install opencv@2

相关文章

相关标签/搜索