问题描述
限时送ChatGPT账号..这是正在使用的代码:
import wget
firefox_29 = "https://ftp.mozilla/pub/firefox/releases/29.0.1/win32/en-
US/Firefox%20Setup%2029.0.1.exe"
firefox_dir = 'C:\\firefox\\firefox29'
wget.download(firefox_29, out=firefox_dir)
这是我得到的错误,我之前以同样的方式使用过 wget 并且它工作正常,所以我对为什么会发生这个错误感到困惑.该链接也是一个工作链接.
This is the error I get, I've used wget before in the same way and it's worked fine so I'm confused as to why this error occurs. Also the link is a working link.
推荐答案
我在不使用 wget 的情况下设法解决了这个问题.显然 wget 只是 urllib 的包装器.所以我用 urlretrieve 代替.代码如下:
I managed to figure it out without using wget. Apparently wget is just a wrapper for urllib. So I used urlretrieve instead. Heres the code:
import urllib.request
firefox_29 = "https://ftp.mozilla/pub/firefox/releases/29.0.1/win32/en-
US/Firefox%20Setup%2029.0.1.exe"
urllib.request.urlretrieve(firefox_29, 'firefox29.exe')
然而,这只是将 .exe 重命名为firefox29.exe",因此如果您需要将其下载到特定位置,您只需自行移动即可.
However this just renames the .exe to "firefox29.exe", so if you need it downloaded to a specific location you just have to move it yourself.
这篇关于HTTP 错误 404:使用 wget 下载链接时未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论