【发布时间】:2016-06-26 03:37:18
【问题描述】:
无法在 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”是我在通过这个命令“brew install opencv --env=std”安装opencv后添加的
请帮帮我,提前谢谢。
【问题讨论】:
-
尝试导入cv2
-
试过但没用 >>>import cv2 .. ImportError: No module named cv2
-
从 Anaconda 调用 cv2,而不是从你的 normal shell
-
在Anaconda下打开了一个终端,试过但同样的错误drive.google.com/file/d/0Bxed_8T6OPe4OWxCdndwdHR1bDQ/…
标签: python macos opencv anaconda