gpt4 book ai didi

ruby - 帮助开始使用 Mechanize

转载 作者:太空宇宙 更新时间:2023-11-03 18:29:20 25 4
gpt4 key购买 nike

我是 Ruby 的新手,刚刚安装了适用于 Windows 的 Ruby。我想使用 mechanize 库 (https://github.com/tenderlove/mechanize),所以我正在按照 https://github.com/tenderlove/mechanize/blob/master/GUIDE.rdoc 上的指南进行操作.

在 Windows cmd 行上,我使用命令“gem install mechanize”安装了 mechanize。

当我运行以下代码时:

require 'rubygems'
require 'mechanize'

agent = Mechanize.new

我得到错误:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- net/http/digest_auth (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from C:/Ruby192/lib/ruby/1.9.1/mechanize.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from helloworld.rb:2:in `<main>'

有人知道这是怎么回事吗?

最佳答案

似乎缺少一些依赖项。尝试安装 net-http-digest_auth gem。

gem install net-http-digest_auth

如果这解决了这个问题并且弹出了另一个(相关)问题,则可能是您缺少 net-http-persistent gem。如果是这样的话,你知道该怎么做!也只需安装它即可。

关于ruby - 帮助开始使用 Mechanize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6482204/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com