我一直在Ubuntu玩Ruby,这是一个有趣的家庭项目。我需要要求Ruby的sqlite3 gem。我目前的ruby版本是ruby 2.3.1
以下是我尝试运行具有require' sqlite3'的ruby文件的内容。宝石线:
warfreak@warfreak-System-Product-Name:~/Documents/projects/MyProject$ ./runner.rb
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in 'require': cannot load such file -- sqlite3 (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from /home/warfreak/Documents/projects/MyProject/encryptor.rb:3:in '<top (required)>'
from /home/warfreak/Documents/projects/MyProject/cryptobreaker.rb:3:in 'require_relative'
from /home/warfreak/Documents/projects/MyProject/cryptobreaker.rb:3:in '<top (required)>'
from ./runner.rb:3:in 'require_relative'
from ./runner.rb:3:in '<main>'
任何人都有想法如何让它运行?
答案 0 :(得分:1)
https://makandracards.com/makandra/1334-install-the-sqlite-3-gem-for-ruby-under-ubuntu
它使用以下命令给出了我需要的适当的ruby gem安装:
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby
这完全解决了我之前遇到的错误。我只想将这些知识分享给任何在Ubuntu 16.04 Linux中安装Ruby gem的人。 ;)