jupyter notebook 使用argparse包报错An exception has occurred, use %tb to see the full traceback
-
参考:https://blog.csdn.net/u012869752/article/details/72513141
-
报错内容:
usage: __main__.py [-h] [--config CONFIG] [--use_parallel USE_PARALLEL]
__main__.py: error: unrecognized arguments: -f /home/ma-user/.local/share/jupyter/runtime/kernel-b6ff3d47-1674-4b19-8b92-98e00c05403c.json
An exception has occurred, use %tb to see the full traceback.
解决办法
parser = argparse.ArgumentParser()
parser.add_argument("--verbosity", help="increase output verbosity")
args = parser.parse_args(args=[])
print(args)
修改最后一行,添加args=[]