我正在按照这个教程学习,并尝试运行以下脚本部分。我正在使用Python 3.7和Spyder 3.3.4。
ap = argparse.ArgumentParser()
ap.add_argument("-d", "--dataset", required=True,
help="path to input dataset (i.e., directory of images)")
ap.add_argument("-m", "--model", required=True,
help="path to output model")
ap.add_argument("-l", "--labelbin", required=True,
help="path to output label binarizer")
ap.add_argument("-p", "--plot", type=str, default="plot.png",
help="path to output accuracy/loss plot")
args = vars(ap.parse_args())
我试过在Run > Configuration per file中输入建议这篇文章和这篇文章中的参数,但是运行脚本时出现了以下错误:
usage: train.py [-h] -d DATASET -m MODEL -l LABELBIN [-p PLOT] train.py: error: the following arguments are required: -d/--dataset, -m/--model, -l/--labelbin An exception has occurred, use %tb to see the full traceback. SystemExit: 2
我已经填写了上面参数的适当路径,然后运行脚本,但是得到了上述错误。如何修复此错误以正确运行脚本并传递参数给Spyder?
path1、path2、path3、path4
传递给Spyder那样,请使用-d path1 -m path2 -l paht3 -p path4
的方式传递。 - Carlos Cordoba