1
當我嘗試運行一個ruby文件「ruby DisplayWishes.rb」時,我收到一個require load error。 我安裝了以下mysql的包,看它是否會幫助目前沒有什麼工作:'require':無法加載這樣的文件--mysql(LoadError)
sudo apt-get install ruby-mysql
sudo apt-get install ruby-mysql2
/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 'require':cannot load such file -- mysql(LoadError)
from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from DisplayWishes.rb:3:in '<main>'
當我試圖寶石安裝mysql & mysql2
sudo gem install mysql2
Fetching: mysql2-0.3.15.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... 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.
您是否安裝了MySQL gem和MySQL Server? –
我安裝了mysql服務器,我不認爲我安裝了mysql gem。 – Alcamech
只是爲了讓你知道,它不是在軌道上的紅寶石。 – Alcamech