我需要在我的项目中使用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.
答案 0 :(得分:12)
我也遇到了这个问题。 要切换到特定分支(2.4.4或2.4.3),您必须导航到正确的git文件夹。在这种情况下,你想去homebrew-science子文件夹。
cd /usr/local/Library/Taps/homebrew-science
git checkout d85d011 opencv.rb
结帐分行2.4.4
brew install opencv
(如果您已经安装了其他版本,则可能需要运行brew unlink opencv
)
答案 1 :(得分:0)
如果有人想通过自制软件安装其他版本的opencv,你可以通过https://github.com/Homebrew/homebrew-science/commits/master/opencv.rb找到合适的opencv.rb版本
0fb1904
适用于2.4.11_2
如果git checkout对您不起作用,您也可以手动复制文件内容。(备份现有的opencv.rb是安全的)