1

我的项目需要使用 OpenCV 2.4.4 版本,但由于某种原因,我无法使用自制软件安装它。

当我运行自制版本的 opencv 时,我得到:

/usr/local$ brew versions opencv
2.4.5    git checkout ae74fe9 /usr/local/Library/Taps/homebrew-science/opencv.rb
2.4.4a   git checkout 3efa797 /usr/local/Library/Taps/homebrew-science/opencv.rb
2.4.4    git checkout d85d011 /usr/local/Library/Taps/homebrew-science/opencv.rb
2.4.3    git checkout 8cb3f45 /usr/local/Library/Taps/homebrew-science/opencv.rb
2.4.2    git checkout b64b319 /usr/local/Library/Taps/homebrew-science/opencv.rb
2.4.1    git checkout 3d32cf1 /usr/local/Library/Taps/homebrew-science/opencv.rb
2.4.0    git checkout 2a8c46b /usr/local/Library/Taps/homebrew-science/opencv.rb
2.3.1a   git checkout cdaf83d /usr/local/Library/Taps/homebrew-science/opencv.rb
2.2      git checkout 032047f /usr/local/Library/Taps/homebrew-science/opencv.rb
2.1.1-pre git checkout 2438f42 /usr/local/Library/Taps/homebrew-science/opencv.rb
HEAD     git checkout c658897 /usr/local/Library/Taps/homebrew-science/opencv.rb
2.1.0    git checkout ecb6a3e /usr/local/Library/Taps/homebrew-science/opencv.rb
/usr/local$  git checkout d85d011 /usr/local/Library/Taps/homebrew-science/opencv.rb

但是当我运行时:

git checkout d85d011 /usr/local/Library/Taps/homebrew-science/opencv.rb

我得到:

error: pathspec 'd85d011' did not match any file(s) known to git.
error: pathspec 'Library/Taps/homebrew-science/opencv.rb' did not match any file(s) known to git.
4

2 回答 2

12

我也遇到了这个问题。要切换到特定分支(2.4.4 或 2.4.3),您必须导航到正确的 git 文件夹。在这种情况下,您要转到 homebrew-science 子文件夹。

  1. cd /usr/local/Library/Taps/homebrew-science

  2. git checkout d85d011 opencv.rb结帐分支 2.4.4

  3. brew install opencvbrew unlink opencv(如果您已经安装了一些其他版本 ,您可能需要运行)

于 2013-09-23T14:27:53.823 回答
0

如果有人想通过自制软件安装其他版本的 opencv,您可以通过https://github.com/Homebrew/homebrew-science/commits/master/opencv.rb找到合适的 opencv.rb 版本

喜欢0fb1904是为了2.4.11_2

如果 git checkout 对您不起作用,您也可以手动复制文件内容。(备份现有的 opencv.rb 以确保安全)

于 2016-10-13T20:24:47.247 回答