使用或不使用Homebrew在Mac上安装OpenCV

时间:2016-05-19 14:35:29

标签: macos opencv

我无法安装Brew来安装OpenCV。

以下是brew给我的错误:

brew install opencv
Error: No available formula with the name "opencv" 
==> Searching for similarly named formulae...
Error: No similarly named formulae found. 
==> Searching taps...
Error: No formulae found in taps.

我以前安装过像hdf5和numpy这样的东西很难,因为brew对我不起作用。它总是说它无法找到公式。我尝试过brew更新和酿造医生。

Brew医生给出了这个:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
/usr/local/CrossPack-AVR/bin/libusb-config

Warning: Your XQuartz (2.7.8_rc1) is outdated
Please install XQuartz 2.7.8:
https://xquartz.macosforge.org

Warning: Python is installed at /Library/Frameworks/Python.framework

Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.

我想我并不喜欢自己安装Python。我相信在我知道brew存在之前很久就安装了它。我这么多年前就这么做了,从那以后就一遍又一遍地更新了它。

因此,在自己编译和安装依赖项之后,我下载了OpenCV和Cmake,并在此处遵循了Cmake设置指南http://blogs.wcode.org/2014/10/howto-install-build-and-use-opencv-macosx-10-10/

以下是我尝试运行make后得到的错误:

Undefined symbols for architecture x86_64:
"_rpl_strerror", referenced from:
testing::internal::GetLastErrnoDescription() in    
libopencv_ts.a(ts_gtest.cpp.o)
testing::internal::DeathTestImpl::ReadAndInterpretStatusByte() in 
libopencv_ts.a(ts_gtest.cpp.o)
testing::internal::ExecDeathTest::AssumeRole() in 
libopencv_ts.a(ts_gtest.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see    
invocation)
make[2]: *** [bin/opencv_perf_core] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
make: *** [all] Error 2

最终目标是安装Caffe。我已经安装了CUDA。它现在只需要OpenCV。

在这一点上帮助我所有的Pythons并尝试使用brew来安装它们会有所帮助吗?我对酿造没有信心,因为它一直说它找不到东西。我可能更喜欢做我自己的构建而且肯定这应该是可行的。无论Cmake失败了什么似乎都不应该与Python有关?

关于系统的更多信息:它运行10.11.9,绝对是x86_64架构,安装了Xcode和命令行工具,有两个Python版本加上Anaconda,并且肯定有一个NVIDIA CPU。总而言之,它是装有开发工具的Macbook Pro Retina。

1 个答案:

答案 0 :(得分:15)

OpenCV位于homebrew-science

您可以点按自制科学

brew tap homebrew/science

之后

brew install opencv

brew install opencv3

或者没有点按:

brew install homebrew/science/opencv
brew install homebrew/science/opencv3