install opencv 3.0.0 with python 3.4 on Mac using Homebrew and Git

http://www.codesec.net/view/167680.html


http://www.codesec.net/view/167680.html

Step1: Installing Xcode

Step 2: Setup Homebrew
      $ cd ~
      $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
      $ brew update


Step 3: Install Python 3S
      $ brew install python3
      $ brew linkapps


Step4: Edit bash profile
      Insert:
      # Homebrew
      export PATH=/usr/local/bin:$PATH

      $ source ~/.bash_profile


Step 4: Confirm that Python 3.4 has been installed:
      $ which python3
           /usr/bin/local/python
      $ python3 --version
           Python 3.4.3

Step 5: Setup our Python 3.4 environment
      $ pip3 install virtualenv virtualenvwrapper

      Insert in bash profile
          # Virtualenv/VirtualenvWrapper
          export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
          source /usr/local/bin/virtualenvwrapper.sh

      $ source ~/.bash_profile


Step 6: enter into python virtual environment
      $ mkvirtualenv cv3 -p python3
      $ workon cv3
      $ pip install numpy


Step 7: Install OpenCV prerequisites
      $ brew install cmake pkg-config
      $ brew install jpeg libpng libtiff openexr
      $ brew install eigen tbb


Step 8: Compile OpenCV
      $ cd ~
      $ git clone https://github.com/Itseez/opencv.git
      $ cd opencv
      $ git checkout 3.0.0

      $ cd ~
      $ git clone https://github.com/Itseez/opencv_contrib
      $ cd opencv_contrib
      $ git checkout 3.0.0

      $ cd ~/opencv
      $ mkdir build
      $ cd build

      $ cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D PYTHON3_PACKAGES_PATH=~/.virtualenvs/cv3/lib/python3.4/site-packages \
      -D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib \
      -D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/include/python3.4m \
      -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=ON \
      -D BUILD_EXAMPLES=ON \
      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules ..

      $ make -j4
      $ sudo make install


Step 9: Verify the install

      $ cd ~/.virtualenvs/cv3/lib/python3.4/site-packages/
      $ ls -l cv2.so
                -rwxr-xr-x 1 admin _developer 2013028 Jun 19 06:11 cv2.so(cv3)74-80-245-164:~ admin

      $ python3
                Python 3.4.3 (default, Jun 19 2015, 05:23:16)
                [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
                Type "help", "copyright", "credits" or "license" for more information.

      >>> import cv2
      >>> cv2.__version__
                '3.0.0'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值