【发布时间】:2020-02-24 15:32:39
【问题描述】:
我有一个包含一组图像的文件夹。我如何将它的路径传递给我以下列方式构造的参数解析器:
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--images", required=True, help="path to images directory")
args = vars(ap.parse_args())
我要经过的路径是home/downloads/images
目前我收到此错误:
usage: detect.py [-h] -i IMAGES
detect.py: error: the following arguments are required: -i/--images
【问题讨论】:
-
你没有设置标志。如果是,请提供脚本崩溃时的 shell。
-
@HampusLarsson 设置标志是什么意思?你能根据问题举个例子吗>
-
我也遇到了同样的问题。你能解决这个问题吗?