使用Homebrew安装openCV时遇到问题

时间:2014-11-17 20:49:00

标签: python opencv homebrew

我正在运行mac os x mavericks并且我试图使用Homebrew安装openCV我不知道如何解决它我应该取消Homebrew和python并再试一次如果是这样我怎么能unistall他们

首先我这样做了 ruby​​ -e" $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 那么这个 brew tap homebrew / science 当我再次输入 brew tap homebrew / science 时,我得到了 警告:已经点击了

但是当我输入 brew info opencv 时出现此错误 错误:没有可用的opencv公式 当我尝试brew 安装opencv 时,它显示了这个

Searching formulae...
Searching taps...
mymac:~ user$

这是我运行酿酒医生时得到的结果

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: 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.

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

    2to3
    2to3-2.7
    idle
    idle2.7
    pydoc
    pydoc2.7
    python
    python-config
    python2.7
    python2.7-config
    pythonw
    pythonw2.7
    smtpd.py
    smtpd2.7.py

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

Warning: Your Xcode (6.0.1) is outdated
Please update to Xcode 6.1.
Xcode can be updated from the App Store.

更新 1

我解决了我的问题我决定发布它以防万一有人遇到同样的问题 这就是我做的事情

untap homebrew/science
brew update
brew doctor 
brew tap homebrew/science

1 个答案:

答案 0 :(得分:1)

这是我在linux上安装的程序。过去它对我来说很有效:

  1. http://opencv.org/downloads.html下载适用于Linux / Mac OS的OpenCV 2.4.9并解压缩。

  2. 在终端中,导航到新提取的目录,并在终端中创建一个名为buildmkdir build的新目录。然后cdbuild

  3. 现在,在终端中输入:

  4.   

    cmake -D CMAKE_BUILD_TYPE = RELEASE -D CMAKE_INSTALL_PREFIX = / usr / local   -D WITH_TBB = ON -D BUILD_NEW_PYTHON_SUPPORT = ON -D WITH_V4L = ON -D INSTALL_C_EXAMPLES = ON -D INSTALL_PYTHON_EXAMPLES = ON -D   BUILD_EXAMPLES = ON -D WITH_QT = ON -D WITH_OPENGL = ON -D BUILD_JPEG = ON ..

    1. 完成后,请输入终端make -j 4这可能需要一段时间。

    2. 现在输入终端sudo make install

    3. 然后sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' sudo ldconfig

    4. 如果有效,你应该能够在python提示符下import cv2而不会出现任何错误。