【问题标题】:wget command not found in git bash在 git bash 中找不到 wget 命令
【发布时间】:2020-10-25 14:54:03
【问题描述】:

我已经在我的 cmd 中尝试过 pip install wget,它显示

>pip install wget
Requirement already satisfied: wget in c:\users\user\...\python\python38-32\lib\site-packages (3.2)

但是当我在 git bash 中尝试该命令时,它一直显示

$ wget
bash: wget: command not found

我已经确定 python 文件和 git 文件都在 PATH 中。

我在这里做错了什么?

【问题讨论】:

  • 也许你该试试 Linux 了 ;)

标签: path wget git-bash


【解决方案1】:

对单个参数进行快速而肮脏的替换,获取文件用例:

alias wget='curl -O'

-O, --remote-name Write output to a file named as the remote file

也许给别名一个不同的名字,这样你就不会尝试在 curl 中使用 wget 标志。

【讨论】:

    【解决方案2】:

    如果您想按照 Paolo 的建议在 Git Bash 上使用 curl,下面是一个示例:

    $ curl -kLSs https://github.com/opscode/chef-repo/tarball/master -o master.tar.gz
      
    $ ls master.tar.gz
    master.tar.gz
    
    • -L 关注重定向
    • -o(小写 O)将输出写入文件而不是标准输出。
    • Ss 静默模式,但显示错误(如果有)
    • k 允许 curl 继续和操作,即使是服务器连接也被认为是不安全的。

    参考:curl 手册页。

    【讨论】:

      【解决方案3】:

      使用命令:

      pip install wget
      

      你安装了这个 Python 库 https://pypi.org/project/wget/,所以你可以在 Python 中使用它:

      import wget
      

      我想你真正想要的是能够在 Git bash 中使用wget。要执行此操作,请安装 Wget for Windows 并将可执行文件添加到路径中。或者,或者,使用curl

      【讨论】:

        猜你喜欢
        • 2016-01-03
        • 2015-08-26
        • 1970-01-01
        • 2019-06-26
        • 2016-06-19
        • 2022-01-19
        • 2016-11-13
        • 2016-08-16
        相关资源
        最近更新 更多