【问题标题】:Why it does not run on Jupyter notebook while does work on command prompt?为什么它不能在 Jupyter 笔记本上运行而在命令提示符下运行?
【发布时间】:2020-08-23 03:22:03
【问题描述】:

我正在尝试运行一个 Python 脚本,它是一个神经网络模型。

当我尝试在命令提示符下运行它时,它会运行,如下所示。

(torch) hkimlx@DESKTOP-62RHFK2:~/GDL/pytorch_geometric/examples$ python gcn.py

但是,当我尝试通过将代码复制到 Jupyter 笔记本上来执行此操作时,它会出现如下错误。

usage: ipykernel_launcher.py [-h] [--use_gdc]
ipykernel_launcher.py: error: unrecognized arguments: -f /home/hkimlx/.local/share/jupyter/runtime/kernel-620f76cb-51fd-4133-8705-eba83e88ac4e.jso

在运行原始代码 (gcn.py) 和 jupyter notebook 中相同目录的相同代码时,我在做不同的事情吗?

非常感谢您!

【问题讨论】:

    标签: python jupyter-notebook


    【解决方案1】:

    我找到了解决方案。代码包含 argparse.ArgumentParser,这不是 jupyter notebook 运行代码的好方法。

    How to fix ipykernel_launcher.py: error: unrecognized arguments in jupyter?

    【讨论】:

      猜你喜欢
      • 2017-03-15
      • 1970-01-01
      • 1970-01-01
      • 2019-05-28
      • 1970-01-01
      • 2017-05-25
      • 2021-01-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多