使用Homebrew安装OpenCV3:opencv没有定义头 [英] Installing OpenCV3 with Homebrew: No head is defined for opencv

查看:157
本文介绍了使用Homebrew安装OpenCV3:opencv没有定义头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装OpenCV3时遇到了我遇到的错误...

I am having trouble installing OpenCV3 with the error I have...

opencv没有定义头

No head is defined for opencv

我在互联网上找不到任何解决方案. 我将这些网站用作参考:

I have not found any solution to on the internet. I used these websites as references:

https://www.learnopencv.com/install-opencv3-on- macos/

我遵循的确切步骤是:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "# Homebrew" >> ~/.bash_profile
echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile

brew install python python3
brew link python
brew link python3

然后我尝试查看我拥有的版本,然后运行:

Then I tried to see what versions I had so I ran:

which python2
which python3

仅存在python3的文件路径,因此我决定显式安装python2:

Only a file path for python3 existed so I decided to explicitly install python2:

brew install python2

然后它说,当我尝试链接它时,它已经被链接了(不确定是否与问题相关,但是可能是这样):

Then it said it was already linked when I tried to link it (not sure if this is relevant to the issue, but it may be):

brew link python2

返回:

警告:已链接:/usr/local/Cellar/python@2/2.7.14_3至 重新链接:brew取消链接python @ 2&&酿造链接python @ 2

Warning: Already linked: /usr/local/Cellar/python@2/2.7.14_3 To relink: brew unlink python@2 && brew link python@2

然后我再次检查which一切都很好,并且现在有python2和python3.

Then I checked it was all good with which again and python2 and python3 were now there.

python2 --version   ===> Python 2.7.14
python3 --version   ===> Python 3.6.4

由于python(我认为)都很好,所以我尝试使用以下命令安装OpenCV3w:

The since the pythons (I think) are all good, I tried installing OpenCV3w with:

brew install opencv3 --with-contrib --with-python3 --HEAD

但错误是

错误:没有为opencv定义头

Error: No head is defined for opencv

需要 是头吗?到底怎么了?

Do I NEED the head? What's wrong with it anyway?

P.S.(不确定).

brew info opencv3

给予

opencv:稳定的3.4.1(瓶装)开源计算机视觉库 https://opencv.org/未从以下位置安装: https://github.com/Homebrew/homebrew-core/blob/master/Formula/opencv.rb ==>依赖关系构建:cmake✘,pkg-config✘必需:eigen✘,ffmpeg✘,jpeg✘,libpng✘,libtiff✘,openexr✘,python✔,python @ 2 ✔,numpy✘,tbb✘

opencv: stable 3.4.1 (bottled) Open source computer vision library https://opencv.org/ Not installed From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/opencv.rb ==> Dependencies Build: cmake ✘, pkg-config ✘ Required: eigen ✘, ffmpeg ✘, jpeg ✘, libpng ✘, libtiff ✘, openexr ✘, python ✔, python@2 ✔, numpy ✘, tbb ✘


非常感谢您的支持,非常感谢!


Thank you so much for any support, MUCH appreciated!

推荐答案

编译OpenCV可能很困难,甚至在MacOS上也更难.自制软件通常可以缓解这种情况,但是目前opencv的食谱是一个好的开始.

Compiling OpenCV can be hard, and even harderon a MacOS. Homebrew alleviates this often, but the current recipe for opencv is a good start.

但是,我遇到了问题,主要是它可以针对python2进行编译,并且我的所有工具链都位于python3中.因此,我创建了一个新的酒桶来安装依赖tbb 然后是 opencv 的一个.为了最终实现编译,您将不必这么做,我必须删除一些依赖项,尤其是对protobuf的依赖项.

However, I had problems with it, the main being that it would compile against python2 and that I have all my toolchain in python3. So I created a new cask to install a dependence on tbb and then one for opencv. You will not that to achieve compilation to the end, I had to remove some dependencies, and in particular that to protobuf.

为方便起见,您可以克隆/下载存储库并启动此脚本 脚本,它将清理内容并运行安装.欢迎任何评论!

For convenience, you can clone / download the repository and launch this script script which cleans up things and then runs the install. Any comments are welcome!

这篇关于使用Homebrew安装OpenCV3:opencv没有定义头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆