ruby - 在 Windows 上的 Ruby 1.9.1 上安装 Hpricot

标签 ruby hpricot

我正在尝试使用以下命令安装 hpricot:

>gem install hpricot -v 0.8.2
Building native extensions.  This could take a while...
ERROR:  Error installing hpricot:
    ERROR: Failed to build gem native extension.<p></p>

<p>C:/Ruby19/bin/ruby.exe extconf.rb
checking for stdio.h... <strong>* extconf.rb failed *</strong>
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.</p>

<p>Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=C:/Ruby19/bin/ruby
C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:362:in <code>try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:431:in</code>try_cpp'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:809:in <code>block in have_header'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:668:in</code>block in checking_for'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in <code>block (2 levels) in postpone'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:in</code>open'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in <code>block in postpone'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:in</code>open'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:270:in <code>postpone'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:667:in</code>checking_for'
    from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:808:in <code>have_header'
    from extconf.rb:2:in</code>'</p>

<p>Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out</p>

它提到我需要安装“开发工具”,但我不知道那指的是什么。有什么建议吗?

最佳答案

尝试:

gem install hpricot --platform=mswin32

关于ruby - 在 Windows 上的 Ruby 1.9.1 上安装 Hpricot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1718500/

相关文章:

ruby - 在 Ruby-watir 中通过 Excel 表传递值

ruby-on-rails - Rails 3. 为什么我的十进制值行是诸如#<BigDecimal :5003750 ,'0.1E2' , 9(18)>> 之类的值?

html - 如何使用 Hpricot 删除 html 元素的样式属性?

ruby - Hpricot 中使用的(例如)除数表示法是什么?

ruby-on-rails - 如何知道何时使用 XML 解析器以及何时使用 ActiveResource?

ruby - 使用 Mechanize 和 Ruby 解析帧中的数据

python - 使用 html 模板格式化 csv 文件数据

带循环的 ruby​​ 函数返回错误值

ruby-on-rails - Ruby on Rails 项目的 CSS Sprite 生成器

ruby-on-rails - Windows 上的 Rails Bundler 拒绝安装 hpricot(即使在手动安装 gem 时也会出现错误 : no such file to load -- hpricot)