【问题标题】:Usage examples show input to a python function that isn't separated by commas? [duplicate]使用示例显示没有用逗号分隔的 python 函数的输入? [复制]
【发布时间】:2020-08-04 21:51:39
【问题描述】:

我正在尝试获取一些我在网上找到的代码来处理 README.md 文件中给出的使用示例。这些工具的目的是从单独的事件中合成音频场景。我不知道如何运行给出的使用示例,它们是:

  * ./simscene.py -h
  Displays command line syntax and option descriptions.

  * ./simscene.py example/sound/ output/ 10 -e example/forest_events.xls -b example/forest_backgrounds.xls -N 10 -v
  Creates wavefiles and plots of 10 instances of scenes for which events are described in example/forest_events.xls and
  background sounds in example/forest_backgrounds.xls

我尝试在终端上运行这些行(我正在使用 PyCharm),但错误是“simscene.py 未被识别为内部或外部命令、可运行程序或批处理文件”,即使我尝试单独运行“simscene.py”,无需输入。

我已经能够通过导入函数 simscene 从另一个脚本运行它,但随后遇到错误。看起来文件 simscene.py 使用 argparse 行来提示用户,但我似乎无法激活这些提示以开始运行。

用法示例如何将指定的输入传递给函数,以及我如何能够运行用法示例?

整个项目的链接在这里: https://bitbucket.org/mlagrange/simscene/src/master/python/

【问题讨论】:

  • 使用pythonpython3 运行python 文件。它不是可执行文件。
  • 这种运行脚本的方式适用于 Unix,而不是 Windows。

标签: python argparse


【解决方案1】:

它可能要求您使用 python 解释器运行文件,即如果您在目录中,

python simscene.py -h

应该可能运行第一个示例。我假设他们没有包含python 部分,因为人们可能有不同的变体(python3numba 等)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-15
    • 1970-01-01
    • 2020-05-21
    • 2022-12-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-20
    • 1970-01-01
    相关资源
    最近更新 更多