无法在macbook OS X Yosemite Ver 10.10.5中安装‘opencv’
尝试默认安装,没有帮助然后我安装了Python的Anaconda发行版,然后再次尝试以下操作,我得到的信息是opencv已安装,但我无法通过python控制台使用它。安装Anaconda之后,我跟随this tutorial安装opencv。
$sudo chmod 777 /usr/local/include/
$brew link eigen jpeg libpng libtiff ilmbase openexr numpy
$sudo chmod 777 /usr/local/lib/pkgconfig
$brew link eigen jpeg libpng libtiff ilmbase openexr numpy
$brew install opencv --evn=std
$brew link eigen jpeg libpng libtiff ilmbase openexr numpy
$sudo chmod 777 /usr/local/lib/
$brew link eigen jpeg libpng libtiff ilmbase openexr numpy
$brew install opencv --evn=std
$python
$mkdir -p /Users/vikramchindam1/.local/lib/python2.7/site-packages
$echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/vikramchindam1/.local/lib/python2.7/site-packages/homebrew.pth然后启动python控制台。
$python
>>> import cv
Python 2.7.11 |Anaconda 2.5.0 (x86_64)| (default, Dec 6 2015, 18:57:58)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv我在一段时间内多次安装了Anaconda,这是一个问题吗?以下是我的.bash_profile中的条目
alias textedit='open -a TextEdit'
# added by Anaconda 2.2.0 installer
export PATH="/Users/vikramchindam1/anaconda/bin:$PATH"
##
# Your previous /Users/vikramchindam1/.bash_profile file was backed up as /Users/vikramchindam1/.bash_profile.macports-saved_2015-06-06_at_15:09:19
##
# MacPorts Installer addition on 2015-06-06_at_15:09:19: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
# added by Anaconda 2.2.0 installer
export PATH="/Applications/anaconda/bin:$PATH"
# added by Anaconda3 2.3.0 installer
export PATH="/Users/vikramchindam1/Documents/Anaconda-3/anaconda/bin:$PATH"
# added by Miniconda2 3.19.0 installer
export PATH="/Users/vikramchindam1/miniconda2/bin:$PATH"
# added by Anaconda2 2.5.0 installer
export PATH="/Users/vikramchindam1/Installations/Anacon-Python2-7/anaconda/bin:$PATH"
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH最后一项"export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH“是我在安装opencv后通过以下命令添加的"brew install opencv --env=std”
请帮帮我,提前谢谢。
发布于 2016-09-01 18:10:14
您必须使用“conda”工具在蟒蛇中安装OpenCV。您可以尝试在您的终端中键入以下内容。
conda install -c https://conda.binstar.org/menpo opencv这在我的ubuntu 14.04上也行得通,我想在Mac上也应该行得通。
您可以在这个链接中找到详细的说明,我在这里展示了如何在蟒蛇中安装OpenCV。
http://stackoverflow.com/questions/38787748/installing-opencv-3-1-with-anaconda-python3/39240127#39240127我希望这对你有帮助=)
https://stackoverflow.com/questions/35930947
复制相似问题