40
44

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyenvでインストールしたpython3からOpenCV3を利用できるようにする

Last updated at Posted at 2015-11-11

anacondaではOpenCV3がインストールできなかったので(2015年11月11日時点でopencv 2.4.10).
opencv3にこだわりがない方は以下のコマンドで導入できます.

conda install -c https://conda.binstar.org/jjhelmus opencv

###環境
Mac OS X 10.10.1
homebrew
pyenv
anaconda3-2.4.0 (installed by pyenv)

###OpenCV 3の導入

brew tap homebrew/science
brew install opencv3 --with-python3
brew link opencv3 --force

###python3からOpenCV3を利用できるようにする

% cd /Users/(ユーザー名)/.pyenv/versions/anaconda3-2.4.0/lib/python3.5/site-packages
% ln -s /usr/local/Cellar/opencv3/3.0.0/lib/python3.5/site-packages/cv2.cpython-35m-darwin.so cv2.so

パスはanacondaやpythonのバージョンに合わせて適宜変更してください.また,"cv2.cpython-35m-darwin.so"についても,各自の環境によってそれっぽいものを探してください.

###テスト

% python
Python 3.5.0 |Anaconda 2.4.0 (x86_64)| (default, Oct 20 2015, 14:39:26)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.0.0'
>>>

import時にエラーが出なかった場合は導入成功です✨

40
44
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
40
44

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?