通过cmd运行时,以下参数是必需的错误

时间:2019-03-07 09:09:34

标签: python argparse

我是使用python的新手,我想运行此代码,但会收到此错误。

代码:

ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
                help="path to the input image")
ap.add_argument("-w", "--width", type=float, required=True,
                help="width of the left-most object in the image (in inches)")
args = vars(ap.parse_args())

错误:

usage: object_size.py [-h] -i IMAGE -w WIDTH
object_size.py: error: the following arguments are required: -i/--image, -w/--width

0 个答案:

没有答案