我正在尝试安装hpricot
,但收到以下错误。我确实安装了xcode,但我不确定我还缺少什么。
$ gem install hpricot
Building native extensions. This could take a while...
ERROR: Error installing hpricot:
ERROR: Failed to build gem native extension.
/Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for stdio.h... *** 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.
我也试过野卷。
$ gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/user_name/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for libxml/parser.h... *** 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.
我认为不再支持hpricot了。你应该看看nokogiri,它要快得多,而且有非常好的记录。
编辑:我刚刚查看了hpricot github页面(https://github.com/hpricot/hpricot/)他们还建议你使用nokogiri:
Hpricot已经结束。请考虑另一种选择,比如野村。
edit#2:如果你在安装它时遇到错误,很可能是因为你缺少libxml和其他库,你需要通过自制软件或macports安装这些库。所有必需的库和安装说明都可以在这里找到:
http://nokogiri.org/tutorials/installing_nokogiri.html
使用Kubuntu 14.04,我只需先安装ruby dev就可以安装hpricot(在错误"error:Failed to build gem native extension."之后)。