前提・実現したいこと
ruby で opencv を使いたいです。
brew install opencv でインストールしましたが、
require 'opencv'をするとエラーが出てしまいます。
発生している問題・エラーメッセージ
require
require 'opencv'
エラー
/usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- opencv (LoadError)
状況・状態
opencvはインストールできている
$ brew install opencv Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae tintin Warning: opencv 3.4.0_1 is already installed
試したこと
which opencv を実行しても、
何も表示されないので、パスを通す必要があるのかと思っているのですが、
どこにパスを通すべきなのか、わかりません。
補足情報
gem install ruby-opencv ができていません。
with でディレクトリを指定しても同様のエラーが出ます。
$ gem install ruby-opencv uilding native extensions. This could take a while... ERROR: Error installing ruby-opencv: ERROR: Failed to build gem native extension. current directory: /usr/local/lib/ruby/gems/2.4.0/gems/ruby-opencv-0.0.18/ext/opencv /usr/local/opt/ruby/bin/ruby -r ./siteconf20180204-3252-17f30oh.rb extconf.rb >> Check the required libraries... checking for -lstdc++... yes checking for -lopencv_calib3d... yes checking for -lopencv_contrib... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/Cellar/ruby/2.4.2_1/bin/$(RUBY_BASE_NAME) --with-opencv-dir --without-opencv-dir --with-opencv-include --without-opencv-include=${opencv-dir}/include --with-opencv-lib --without-opencv-lib=${opencv-dir}/lib --with-libxml2-dir --without-libxml2-dir --with-libxml2-include --without-libxml2-include=${libxml2-dir}/include --with-libxml2-lib --without-libxml2-lib=${libxml2-dir}/lib --with-stdc++lib --without-stdc++lib --with-opencv_calib3dlib --without-opencv_calib3dlib --with-opencv_contriblib --without-opencv_contriblib extconf.rb:58:in `block in <main>': opencv_contrib not found. (RuntimeError) from extconf.rb:58:in `each' from extconf.rb:58:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ruby-opencv-0.0.18/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/ruby-opencv-0.0.18 for inspection. Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ruby-opencv-0.0.18/gem_make.out
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/02/04 08:52