2016-03-11 57 views
2

無法在的MacBook運行OS X Yosemite版安裝「OpenCV的10.10.5opencv的安裝在Mac上,但無法通過蟒控制檯來使用它

試了默認安裝,沒有幫助,然後我安裝了Python的蟒蛇分佈,後再次嘗試以下,我收到消息說opencv已安裝,但我無法通過python控制檯使用它。安裝後蟒蛇,我也跟着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 

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

我做了蟒蛇的多個安裝在一段時間是一個問題?以下是我的.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 

最後進入 「出口PYTHONPATH =在/ usr/local/lib目錄/ python2.7/site-packages中:$ PYTHONPATH」 由我通過這個命令的OpenCV安裝後加入「 brew install opencv --env = std「

請幫助我,謝謝提前。

+0

嘗試導入** ** CV2代替 –

+0

嘗試,但不工作>>>進口CV2 ..導入錯誤:沒有模塊名爲CV2 – Vikram

+0

電話CV2從蟒蛇,而不是從你的*正常*外殼 –

回答

0

您必須使用'conda'工具在Anaconda中安裝OpenCV。你可以嘗試在你的終端上輸入。

​​

這工作在我的Ubuntu 14.04,我認爲它也應該在Mac上工作。

你可以在這個鏈接中找到詳細的說明,我展示瞭如何在Anaconda中安裝OpenCV。

http://stackoverflow.com/questions/38787748/installing-opencv-3-1-with-anaconda-python3/39240127#39240127 

我希望它幫你=)

相關問題