args = parser.parse_args報錯:ipykernel_launcher.py: error: unrecognized arguments。
或:
args = parser.parse_args報錯:An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
今天使用Python的args = parser.parse_args時遇到了以下錯誤:
錯誤訊息
- usage: ipykernel_launcher.py [-h] [--video VIDEO] [--model MODEL] [--thr THR]
- ipykernel_launcher.py: error: unrecognized arguments: -f C:\Users\Administrator\AppData\Roaming\jupyter\runtime\kernel-4c7fcf99-ee3a-4e65-887c-02f3f18a6a6d.json
複製代碼[backcolor=rgba(255, 255, 255, 0.88)]如何解決呢? [backcolor=rgba(255, 255, 255, 0.88)]將 args = parser.parse_args() [backcolor=rgba(255, 255, 255, 0.88)]改成 args = parser.parse_args(args=[]) [backcolor=rgba(255, 255, 255, 0.88)]
[backcolor=rgba(255, 255, 255, 0.88)]改完重新執行程式後,錯誤就消失了。 [backcolor=rgba(255, 255, 255, 0.88)]
[backcolor=rgba(255, 255, 255, 0.88)]參考文章
|