开发者

cannot require ruby wordnet gem

I installed ruby gem 'wordnet', a gem on English linguistic. After I installed it (wordnet 0.0.5), when I tried to require it using irb, I got the following errors:

&开发者_Go百科gt;> require 'wordnet'
LoadError: no such file to load -- bdb
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
    from /Library/Ruby/Gems/1.8/gems/wordnet-0.0.5/lib/wordnet/lexicon.rb:34
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:29:in `require'
    from /Library/Ruby/Gems/1.8/gems/wordnet-0.0.5/lib/wordnet.rb:83
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:32:in `require'
    from (irb):2
    from /Library/Ruby/Site/1.8/rubygems/specification.rb:638

how to solve this and make it work?


Looks like the wordnet gem is requiring the Berkley DB library. Try to do a

gem install bdb

and then try again.


I managed to get past this problem with the following:

$ brew install berkeley-db

Then got the bdb from here: https://github.com/knu/ruby-bdb

$ ruby extconf.rb --with-db-dir=/usr/local/Cellar/berkeley-db/5.1.19
$ make 
$ install
$ gem install bdb

now I can require 'wordnet'


Getting the wordnet gem running properly is a little tricky. I finally got it working after a lot of trail and error.

I wrote down all the steps I took in this gist: https://gist.github.com/1779371

You should be able to grab what you need from there to get it running.


Try calling require 'rubygems' and then require 'wordnet'

See if that works.

Also, make sure you have the latest version of Xcode from Apple installed. That comes with some Ruby dependencies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜