没有要加载的文件——sqlite3/sqlite3_native

发布于 2024-12-07 07:32:58 字数 1645 浏览 1 评论 0原文

我在 OSX (Leopard) 上尝试运行以下 ruby​​ 脚本时遇到问题。

    require 'sqlite3'
    database = SQLite3::Database.new( "new.database" )

    database.execute( "create table sample_table (id INTEGER PRIMARY KEY, sample_text TEXT, sample_number NUMERIC);" )

    database.execute( "insert into sample_table (sample_text,sample_number) values ('Sample Text1', 123)")
    database.execute( "insert into sample_table (sample_text,sample_number) values ('Sample Text2', 456)")

    rows = database.execute( "select * from sample_table" )

    p rows

但我收到以下错误:

/Users/Ted/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
    from /Users/Ted/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/Ted/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.4/lib/sqlite3.rb:6:in `rescue in <top (required)>'
    from /Users/Ted/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.4/lib/sqlite3.rb:2:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:33:in `require'
    from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from sequelsample.rb:1:in `<main>'

如何解决此问题?我已经使用 ruby​​ 1.9.2p180(2011-02-18 修订版 30909)[i386-darwin9.8.0] 使用命令安装了以下 gem:

sudo gem install sqlite3-ruby -- --with-sqlite3-dir=/sw
sudo gem install sqlite3 -- --with-sqlite3-dir=/sw

sqlite3 (1.3.4)
sqlite3-ruby (1.3.3)

I am having trouble trying to run the following ruby script on OSX (Leopard).

    require 'sqlite3'
    database = SQLite3::Database.new( "new.database" )

    database.execute( "create table sample_table (id INTEGER PRIMARY KEY, sample_text TEXT, sample_number NUMERIC);" )

    database.execute( "insert into sample_table (sample_text,sample_number) values ('Sample Text1', 123)")
    database.execute( "insert into sample_table (sample_text,sample_number) values ('Sample Text2', 456)")

    rows = database.execute( "select * from sample_table" )

    p rows

but I get the following error:

/Users/Ted/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
    from /Users/Ted/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/Ted/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.4/lib/sqlite3.rb:6:in `rescue in <top (required)>'
    from /Users/Ted/.rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.4/lib/sqlite3.rb:2:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:33:in `require'
    from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from sequelsample.rb:1:in `<main>'

How can I fix this issue? I have installed the following gems with the commands using ruby 1.9.2p180 (2011-02-18 revision 30909) [i386-darwin9.8.0]:

sudo gem install sqlite3-ruby -- --with-sqlite3-dir=/sw
sudo gem install sqlite3 -- --with-sqlite3-dir=/sw

sqlite3 (1.3.4)
sqlite3-ruby (1.3.3)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不知所踪 2024-12-14 07:32:58

用这个命令修复它:

  gem uninstall sqlite3
  gem uninstall sqlite3-ruby
  sudo gem install sqlite3 -- --with-sqlite3-dir=/sw

Ted

Fixed it with this commands:

  gem uninstall sqlite3
  gem uninstall sqlite3-ruby
  sudo gem install sqlite3 -- --with-sqlite3-dir=/sw

Ted

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文