gpt4 book ai didi

python - 使用 Homebrew 安装 openCV 时遇到问题

转载 作者:太空宇宙 更新时间:2023-11-03 22:57:18 25 4
gpt4 key购买 nike

我正在运行 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 时,我收到了警告:已点击!

但是当我输入 brew info opencv 时,我收到了这个错误错误:opencv 没有可用的公式当我尝试 brew install opencv 它显示了这个

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

这是我运行 brew doctor 时得到的结果

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

最佳答案

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

  1. http://opencv.org/downloads.html 下载 OpenCV 2.4.9适用于 Linux/Mac OS 和提取。

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

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

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 而不会出现任何错误。

关于python - 使用 Homebrew 安装 openCV 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26981728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com