我已经尝试了人们在这里谈论的所有其他解决方案,但没有一个有帮助/应用。
我编写了一个需要电子表格 gem 的 Ruby 脚本。当我正常执行脚本时,要求工作正常ruby myscript.rb
,但是在运行之后chmod +x myscript.rb
,然后尝试运行程序时./myscript.rb
出现以下错误....
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- spreadsheet (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/fcangialosi/dev/mTC/parse.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/fcangialosi/dev/mTC/interpreter.rb:1:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from ./pmcnp.rb:7:in `<main>'
我的脚本的开头如下所示:
#!/usr/bin/ruby
require 'rubygems'
require 'spreadsheet'
如果有人有任何想法,我将不胜感激。