HTTP 错误 404:使用 wget 下载链接时未找到

编程入门 行业动态 更新时间:2024-10-18 03:32:36
本文介绍了HTTP 错误 404:使用 wget 下载链接时未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-26 04:00:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128936.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:下载链接   未找到   错误   HTTP   wget

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!