【问题标题】:Invalid Syntax 'jupiter notebook' while jupyter is installed +imported安装 jupyter 时语法无效 \'jupyter notebook\' +导入
【发布时间】:2022-08-21 16:37:57
【问题描述】:

我目前正在学习代码并且在 python 中遇到了 Jupyter 的问题。

我用的是Python3.10,我已经升级了pip,模块在好PATH中,我已经导入了jupyter。

我尝试在解释器中以两种不同的方式打开笔记本:

#Input1
>>> jupyter notebook

#Output1
File \"<stdin>\", line 1
    jupyter notebook
            ^^^^^^^^
SyntaxError: invalid syntax

#Input2
>>> py -3.9 -m jupyter notebook
#Output2
  File \"<stdin>\", line 1
    py -3.9 -m jupyter notebook
               ^^^^^^^
SyntaxError: invalid syntax

我也在终端做了它以防万一......但我得到了一些其他错误(从FR翻译):

jupyter-notebook: The term \"jupyter-notebook\" is not recognized as a name
cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path exists, verify that the
path is correct and try again.
To Line:1 character : 1

你知道发生了什么吗?

祝你有美好的一天 !

  • 您是否在终端尝试过“jupyter notebook”?
  • 是的 !第二个代码块是输入 \"jupyter notebook\" 时的输出!
  • 您使用的是什么操作系统?
  • 前缀&gt;&gt;&gt; 看起来你在尝试启动笔记本服务器时已经在 Python 中,这不是它的设计工作方式。你应该在你的 shell 中(即 cmd 或 power shell,如果你在 Windows 中)。只需在那里运行您的py -3.9 -m jupyter notebook 命令就可以了
  • 看起来你在窗户上。你应该运行py -m jupyter notebook在终端(不是提示。)。如果这不起作用,请检查您是否使用py -m pip install jupyter-notebook 安装了jupyter-notebook

标签: python jupyter-notebook jupyter


【解决方案1】:

看起来你在窗户上。

你应该运行py -m jupyter notebook在终端(不是 python 提示符。)。

如果这不起作用,请检查您是否使用py -m pip install notebook 安装了jupyter-notebook

另外,如果你使用python 3.10,你应该不是运行py -3.9

【讨论】:

  • 只需尝试使用您的代码安装 jupyter notebook 并获得以下信息:PS C:\Users\Leo\Documents\VSCode&gt; py -m pip install jupyter-notebook ERROR: Could not find a version that satisfies the requirement jupyter-notebook (from versions: none) ERROR: No matching distribution found for jupyter-notebook
  • 哦,是的,对不起,这只是py -m pip install notebook
  • 安装工作完美,但是,我仍然收到相同的消息...jupyter-notebook: The term "jupyter-notebook" is not recognized as a name cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path exists, verify that the path is correct and try again. To Line:1 character : 1
【解决方案2】:

安装并调用 CMD 后,我的 jupyter 笔记本无法正常工作。

然后我只在命令提示符(cmd)中使用“pip install simplejson”。然后我写了“jupyter notebook”,它就可以工作了!

有人在“pip install simplejson”之前使用“pip uninstall simplejson”。

【讨论】:

  • 这如何帮助解决最初的问题?
  • 只是按照您的建议进行操作,但我仍然收到“无效语法”错误消息...
  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-11-06
  • 2018-11-29
  • 1970-01-01
  • 2023-04-11
  • 1970-01-01
  • 2022-01-12
  • 1970-01-01
相关资源
最近更新 更多