我尝试安装 Ruby selenium-webdriver 但出现此错误:
sudo gem install selenium-webdriver
[sudo] password for sam:
Building native extensions. This could take a while...
ERROR: Error installing selenium-webdriver:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.4.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.4 -r ./siteconf20170509-10458-cbn64m.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.4.0/gems/ffi-1.9.18 for inspection.
Results logged to /var/lib/gems/2.4.0/extensions/x86_64-linux/2.4.0/ffi-1.9.18/gem_make.out
我尝试了从不同论坛找到的不同方法,但它们对我不起作用。Ruby 版本是 2.4,Ubuntu 版本是 16.04
答案1
我尝试了这个,它解决了我的问题:
sudo apt-get install ruby2.4-dev