2012-07-23 43 views
1

我正在尝试安装hpricot,并且出现以下错误。我确实安装了xcode,但我不确定我还缺少了什么。安装hpricot

$ 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. 

我也试过nokogiri。

$ 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. 

回答

1

我不认为hpricot支持了。你应该看看nokogiri,它要快得多,而且记录完备。

编辑:我刚才检查的角度来说,Hpricot GitHub的页面(https://github.com/hpricot/hpricot/),他们也建议你使用引入nokogiri:

Hpricot has ended. Please consider an alternative like nokogiri.

编辑#2:如果你正在运行在安装它时出错,很可能是因为您缺少libxml和其他库,您需要通过自制软件或macports进行安装。所有所需的库和安装说明可以在这里找到:

http://nokogiri.org/tutorials/installing_nokogiri.html

+0

请参阅上面的nokogiri。 – locoboy 2012-07-23 01:44:44

+0

更新了我的回答:) – Sean 2012-07-23 01:51:41

+0

我安装了nokogiri的东西,但得到相同的答案。 – locoboy 2012-07-23 02:36:19

0

它看起来像你没有libxml的,或者libxml的开发库,从引入nokogiri生成的错误消息。

0

使用Kubuntu 14.04我首先安装了ruby-dev,然后安装了hpricot(错误“ERROR:Failed to build gem native extension。”)。