【问题标题】:Trying to Create a Shell Script Running a Python Script using wget尝试使用 wget 创建运行 Python 脚本的 Shell 脚本
【发布时间】:2014-09-19 23:38:09
【问题描述】:

我正在尝试每天调用一次 API,并使用 Python 将数据保存在 json 中并将其转换为 csv 文件。

我正在使用 wget 库来下载文件。 即使我正确安装了 wget 并且能够在 Python Shell 中使用它,我也无法在 bash 中运行脚本,因为我收到了错误:

File "<stdin>", line 1, in <module>
ImportError: No module named wget

如何在 bash 上安装 wget? 也许有一个我可以使用的内置库?

我使用 wget 的代码是:

import wget

file_url = 'http://api-website'
file_name = wget.download(file_url)

【问题讨论】:

  • 您可能需要使用 pip 安装 wget python 模块。

标签: python bash shell wget


【解决方案1】:

下载wget表单this链接并使用以下命令安装:

提取 Wget

$ cd /tmp/wget
$ gzip -dc < wget-2.2.tar.gz | tar -xf -
$ cd wget-2.2

构建 Wget

$ ./configure --prefix=/usr
$ make

安装Wget(必须是root用户)

$ sudo make install

【讨论】:

  • 我使用的是cygwin,所以我认为这两个命令都不适用。
猜你喜欢
  • 1970-01-01
  • 2021-01-22
  • 1970-01-01
  • 2019-02-10
  • 1970-01-01
  • 2013-10-02
  • 2023-02-21
  • 2018-05-19
  • 1970-01-01
相关资源
最近更新 更多