【问题标题】:Getting strange error while downloading .xlsx file with wget [duplicate]使用 wget 下载 .xlsx 文件时出现奇怪的错误
【发布时间】:2021-10-12 14:11:07
【问题描述】:

我在 Win10 Home (RU) 上使用 Jupyter Notebook。所以, 我尝试下载 .xlsx 文件并同时将其命名为 'data_3_course.xlsx' - 使用该代码:

!wget  -O 'data_3_course.xlsx' -q 'https://www.dropbox.com/s/ysxs5srafoyxknb/_data_3_course.xlsx?dl=1' 

但我得到一个非常奇怪的异常\错误(粉红色):

"wget" Ґ пў«пҐвбп ўгв॥© Ё«Ё ўҐиҐ©
Є®¬ ¤®©, ЁбЇ®«пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐвл¬ д ©«®¬.

=

"wget" it is not an internal or external
command, an executable program, or a batch file

好吧,一些有用的信息wget-3.2 模块已导入 - pip list 找到它in this pic,链接有效(手动下载文件)。 如何解决?

【问题讨论】:

    标签: python-3.x exception wget downloadfile


    【解决方案1】:

    得到一个非常奇怪的异常\error

    你的编码有问题,在这种情况下,我使用2cyr.com 可以恢复它应该是的

    "wget" е является вутреей или вешей
    ком дой, исполяемой прогр ммой или п кетым ф йлом.
    

    据我所知,这是清晰的俄语文本。

    wget-3.2 模块已导入 - pip list 在此图片中找到它,链接有效(文件是手动下载的)。如何解决?

    你可能误会了两个不同的 wget - GNU wget 可以在终端中用作 wgetwget 这是 python 的外部模块。如果你想从终端使用第二个,你应该遵守描述的Usage,即下载http://www.example.com/ as example.html do

    python -m wget -o example.html http://www.example.com/
    

    【讨论】:

    • 非常感谢!!我明白代码中发生了什么))我用我自己的观察、工作代码和你的链接添加了一个答案(希望你不会介意:)
    【解决方案2】:

    所以有一个非常重要的通知@Daweo 我得到了很好的教训:

    (JN = Jupyter 笔记本)

    1. 如果我想用GNU wget下载文件(阅读它here) 在 JN 中,我应该将 wget.exe 放在 PATH 目录中并重新启动 JN; 代码将是:

      !wget https://www.dropbox.com/s/ysxs5srafoyxknb/_data_3_course.xlsx?dl=1 -O data_3_course_copy2.xlsx
      

      在终端中代码与没有'!'的代码相同。

    2. 如果我想用 python wget 模块下载文件(阅读它 here) 在 JN 中:

      pip install wget
      import wget
      url = 'https://www.dropbox.com/s/ysxs5srafoyxknb/_data_3_course.xlsx?dl=1'
      
      wget.download(url, '/Users/ASUS/Downloads/data_3_course_copy.xlsx')
      

      在终端中它的代码看起来像@Daweo 写的:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-09
      • 1970-01-01
      • 1970-01-01
      • 2012-07-26
      • 2018-11-27
      • 2020-08-30
      • 2013-05-05
      • 2011-04-10
      相关资源
      最近更新 更多