1

尝试从此 Python 脚本加载图像时遇到了麻烦。它在 Windows 10 中运行良好。我不确定为什么它在我的 Windows 7 系统中不起作用。

from __future__ import print_function
import argparse
import cv2

ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True,
            help = "Path to the image")
args = vars(ap.parse_args())

image = cv2.imread(args["image"])

在我运行的 CMD 中,

showimage.py --image syiling.png

然后它返回

showimage.py error argument is required

在此处输入图像描述

4

0 回答 0