首页 文章

使用Homebrew安装openCV时遇到问题

提问于
浏览
1

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

首先我做了这个 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 然后这个 brew tap homebrew/science 当我再次输入 brew tap homebrew/science 时工作了_z63951_

但当我输入 brew info opencv 时出现此错误 Error: No available formula for opencv 当我尝试brew install 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 回答

  • 1

    这是我在linux上安装的程序 . 它在过去对我有用:

    • 从Linux / Mac OS的http://opencv.org/downloads.html下载OpenCV 2.4.9并解压缩 .

    • 在终端中,导航到新提取的目录,并在终端中使用 mkdir build 创建一个名为 build 的新目录 . 然后 cdbuild

    • 现在,在终端中输入:

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

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

    • 现在输入终端 sudo make install

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

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

相关问题