openCV3のインストールについて質問させていただきます。
環境はMac OSX10.10.5、python3.4.3が使える状況です。
一応、おそらく無事インストールできている雰囲気なのですが、ターミナルより試すと
bash
1python3 2Python 3.4.3 (default, Aug 11 2015, 08:57:25) 3[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin 4Type "help", "copyright", "credits" or "license" for more information. 5>>> import cv2 6Traceback (most recent call last): 7 File "<stdin>", line 1, in <module> 8ImportError: No module named 'cv2'
となってしまいます。
インストールする処理の過程などもいろいろ調べてみたのですが、原因がイマイチわからないので、どなたか教えていただけませんでしょうか。
ちなみにターミナルで行った処理とそのときのエラーです。
bash
1hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew install numpy --with-python3 2Warning: homebrew/python/numpy-1.9.3 already installed, it's just not linked 3 4hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew link openexr numpy 5Linking /usr/local/Cellar/openexr/2.2.0... 6Error: Could not symlink share/aclocal/openexr.m4 7/usr/local/share/aclocal is not writable. 8 9hiroshi-no-MacBook-Air:Pro-tr hiroshi$ sudo chown -R hiroshi /usr/local/share/aclocal 10Password: 11hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew link openexr 12Linking /usr/local/Cellar/openexr/2.2.0... 103 symlinks created 13 14hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew link openexr numpy 15Warning: Already linked: /usr/local/Cellar/openexr/2.2.0 16To relink: brew unlink openexr && brew link openexr 17Linking /usr/local/Cellar/numpy/1.9.3... 18Error: Could not symlink bin/f2py 19Target /usr/local/bin/f2py 20already exists. You may want to remove it: 21 rm '/usr/local/bin/f2py' 22 23To force the link and overwrite all conflicting files: 24 brew link --overwrite numpy 25 26To list all files that would be deleted: 27 brew link --overwrite --dry-run numpy 28hiroshi-no-MacBook-Air:Pro-tr hiroshi$ 29 30hiroshi-no-MacBook-Air:Pro-tr hiroshi$ rm '/usr/local/bin/f2py' 31hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew link --overwrite numpy 32Linking /usr/local/Cellar/numpy/1.9.3... 392 symlinks created 33hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew link --overwrite --dry-run numpy 34Warning: Already linked: /usr/local/Cellar/numpy/1.9.3 35To relink: brew unlink numpy && brew link numpy 36hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew link numpy 37Warning: Already linked: /usr/local/Cellar/numpy/1.9.3 38To relink: brew unlink numpy && brew link numpy 39 40hiroshi-no-MacBook-Air:Pro-tr hiroshi$ brew install opencv3 --with-python3 41==> Installing opencv3 from homebrew/homebrew-science 42==> Installing dependencies for homebrew/science/opencv3: cmake, pkg-config, homebrew/python/numpy 43==> Installing homebrew/science/opencv3 dependency: cmake 44==> Downloading https://homebrew.bintray.com/bottles/cmake-3.3.1.yosemite.bottle.1.tar.gz 45######################################################################## 100.0% 46==> Pouring cmake-3.3.1.yosemite.bottle.1.tar.gz 47==> Caveats 48Emacs Lisp files have been installed to: 49/usr/local/share/emacs/site-lisp/ 50 51Add the following to your init file to have packages installed by Homebrew added to your load-path: 52(let ((default-directory "/usr/local/share/emacs/site-lisp/")) 53 (normal-top-level-add-subdirs-to-load-path)) 54==> Summary 55???? /usr/local/Cellar/cmake/3.3.1: 1901 files, 33M 56==> Installing homebrew/science/opencv3 dependency: pkg-config 57==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.28.yosemite.bottle.2.tar.gz 58######################################################################## 100.0% 59==> Pouring pkg-config-0.28.yosemite.bottle.2.tar.gz 60???? /usr/local/Cellar/pkg-config/0.28: 10 files, 612K 61==> Installing homebrew/science/opencv3 dependency: homebrew/python/numpy 62==> Using Homebrew-provided fortran compiler. 63This may be changed by setting the FC environment variable. 64==> Downloading https://pypi.python.org/packages/source/n/numpy/numpy-1.9.3.tar.gz 65######################################################################## 100.0% 66==> Downloading https://pypi.python.org/packages/source/n/nose/nose-1.3.4.tar.gz 67######################################################################## 100.0% 68==> python -c import setuptools... --no-user-cfg install --prefix=/usr/local/Cellar/numpy/1.9.3/libexec/nose --sin 69==> python setup.py build --fcompiler=gnu95 install --prefix=/usr/local/Cellar/numpy/1.9.3 70==> Downloading https://pypi.python.org/packages/source/n/nose/nose-1.3.4.tar.gz 71Already downloaded: /Library/Caches/Homebrew/numpy--nose-1.3.4.tar.gz 72==> python3 -c import setuptools... --no-user-cfg install --prefix=/usr/local/Cellar/numpy/1.9.3/libexec/nose --si 73==> python3 setup.py build --fcompiler=gnu95 install --prefix=/usr/local/Cellar/numpy/1.9.3 74Error: The `brew link` step did not complete successfully 75The formula built, but is not symlinked into /usr/local 76Could not symlink lib/python3.4/site-packages/numpy/__config__.py 77Target /usr/local/lib/python3.4/site-packages/numpy/__config__.py 78already exists. You may want to remove it: 79 rm '/usr/local/lib/python3.4/site-packages/numpy/__config__.py' 80 81To force the link and overwrite all conflicting files: 82 brew link --overwrite numpy 83 84To list all files that would be deleted: 85 brew link --overwrite --dry-run numpy 86 87Possible conflicting files are: 88/usr/local/lib/python3.4/site-packages/numpy/__config__.py 89/usr/local/lib/python3.4/site-packages/numpy/__init__.py 90 91#####.pyで終わるファイルがずらっと並んでいるので中略。 92 93/usr/local/lib/python3.4/site-packages/numpy/tests/test_ctypeslib.py 94/usr/local/lib/python3.4/site-packages/numpy/tests/test_matlib.py 95/usr/local/lib/python3.4/site-packages/numpy/version.py 96==> Caveats 97Python modules have been installed and Homebrew's site-packages is not 98in your Python sys.path, so you will not be able to import the modules 99this formula installed. If you plan to develop with these modules, 100please run: 101 mkdir -p /Users/hiroshi/Library/Python/2.7/lib/python/site-packages 102 echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/hiroshi/Library/Python/2.7/lib/python/site-packages/homebrew.pth 103==> Summary 104???? /usr/local/Cellar/numpy/1.9.3: 1379 files, 28M, built in 3.7 minutes 105==> Installing homebrew/science/opencv3 106==> Using Homebrew-provided fortran compiler. 107This may be changed by setting the FC environment variable. 108==> Downloading https://github.com/Itseez/opencv/archive/3.0.0.tar.gz 109==> Downloading from https://codeload.github.com/Itseez/opencv/tar.gz/3.0.0 110######################################################################## 100.0% 111==> Downloading https://downloads.sourceforge.net/project/opencvlibrary/3rdparty/ippicv/ippicv_macosx_20141027.tgz 112==> Downloading from http://netassist.dl.sourceforge.net/project/opencvlibrary/3rdparty/ippicv/ippicv_macosx_20141 113######################################################################## 100.0% 114==> cmake .. -DCMAKE_C_FLAGS_RELEASE= -DCMAKE_CXX_FLAGS_RELEASE= -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv3/ 115==> make 116==> make install 117==> Caveats 118This formula is keg-only, which means it was not symlinked into /usr/local. 119 120opencv3 and opencv install many of the same files. 121 122Generally there are no consequences of this for you. If you build your 123own software and it requires this formula, you'll need to add to your 124build variables: 125 126 LDFLAGS: -L/usr/local/opt/opencv3/lib 127 CPPFLAGS: -I/usr/local/opt/opencv3/include 128 129If you need Python to find bindings for this keg-only formula, run: 130 echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth 131 mkdir -p /Users/hiroshi/Library/Python/2.7/lib/python/site-packages 132 echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/hiroshi/Library/Python/2.7/lib/python/site-packages/homebrew.pth 133==> Summary 134???? /usr/local/Cellar/opencv3/3.0.0: 247 files, 104M, built in 17.0 minutes 135hiroshi-no-MacBook-Air:Pro-tr hiroshi$

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/02/11 10:32
2016/02/13 06:51
2016/02/13 08:26
2016/02/13 08:29
2016/02/13 08:39
2016/02/13 08:44
2016/02/13 08:46
2016/02/13 08:46
2016/02/13 08:47
2016/02/14 05:53 編集
2016/02/15 14:04