LoginSignup
6
6

More than 5 years have passed since last update.

homebrewでopencvがインストール出来ない場合

Posted at

scienceっていうリポジトリ(?)を追加する必要があるみたいです。
あとは、import opencv としたときに、Segmentation fault: 11のエラーが出る問題に悩まされました。

パスの設定が悪かったみたいです。

作業ログ

brew tap homebrew/science
brew intall opencv

Added "science" tap to homebrew so it can find OpenCV. by codetab · Pull Request #511 · sightmachine/SimpleCV

meganii-air:~ meganii$ brew install python
==> Installing dependencies for python: readline, sqlite, gdbm, openssl
==> Installing python dependency: readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.3.6.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-6.3.6.mountain_lion.bottle.tar.gz
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary
?  /usr/local/Cellar/readline/6.3.6: 40 files, 2.1M
==> Installing python dependency: sqlite
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/sqlite-3.8.5.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.8.5.mountain_lion.bottle.tar.gz
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

OS X provides an older sqlite3.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/sqlite/lib
    CPPFLAGS: -I/usr/local/opt/sqlite/include

==> Summary
?  /usr/local/Cellar/sqlite/3.8.5: 9 files, 2.1M
==> Installing python dependency: gdbm
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gdbm-1.11.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.11.mountain_lion.bottle.tar.gz
?  /usr/local/Cellar/gdbm/1.11: 16 files, 420K
==> Installing python dependency: openssl
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl-1.0.1h.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.1h.mountain_lion.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

The OpenSSL provided by OS X is too old for some software.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
?  /usr/local/Cellar/openssl/1.0.1h: 429 files, 15M
==> Installing python
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7.7_2.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python-2.7.7_2.mountain_lion.bottle.tar.gz
==> Caveats
Setuptools and Pip have been installed. To update them
  pip install --upgrade setuptools
  pip install --upgrade pip

You can install Python packages with
  pip install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pip2.7
Target /usr/local/bin/pip2.7
already exists. You may want to remove it:
  rm /usr/local/bin/pip2.7

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

Possible conflicting files are:
/usr/local/bin/pip2.7
/usr/local/bin/pip2
/usr/local/bin/pip
/usr/local/bin/easy_install-2.7
/usr/local/bin/easy_install
==> /usr/local/Cellar/python/2.7.7_2/bin/python -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/2.7.7_2/bin --install-lib=/usr/local/lib/python2.7/site-packages
==> /usr/local/Cellar/python/2.7.7_2/bin/python -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/2.7.7_2/bin --install-lib=/usr/local/lib/python2.7/site-packages
==> Summary
?  /usr/local/Cellar/python/2.7.7_2: 4634 files, 74M

which pythonを試してみると、/usr/bin/pythonを利用していたので、
PATHに/usr/local/binを追加して、再度、brew install opencvで再コンパイルしてみると上手く動きました。

PYTHONPATHを設定

export PYTHONPATH="/usr/local/lib/python2.7/site-packages/:$PYTHONPATH"
6
6
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
6
6