Python shell prompts cannot be detected

每次启动 python shell 都会有 warning:

Warning (python): Python shell prompts cannot be detected.
If your emacs session hangs when starting python shells
recover with ‘keyboard-quit’ and then try fixing the
interactive flag for your interpreter by adjusting the
‘python-shell-interpreter-interactive-arg’ or add regexps
matching shell prompts in the directory-local friendly vars:
  + ‘python-shell-prompt-regexp’
  + ‘python-shell-prompt-block-regexp’
  + ‘python-shell-prompt-output-regexp’
Or alternatively in:
  + ‘python-shell-prompt-input-regexps’
  + ‘python-shell-prompt-output-regexps’

相关信息:

  • OS: Windows

  • Python: 3.6.5

  • Emacs: emacs 27.0.50-pdump

  • python-shell-interpreter: jupyter

  • python-shell-interpreter-arg: console --simple-prompt

  • python-shell-prompt-input-regexps:

(">>> " "\\.\\.\\. " "In \\[[0-9]+\\]: " " \\.\\.\\.: " "In : " "\\.\\.\\.: ")

  • python-shell-prompt-output-regexps: ("" "Out\\[[0-9]+\\]: " "Out :")

除了警告。使用上正常,没有什么异常。

–simple-prompt 命令行参数 会让jupyter像ipython 一样的打印 Out [1] 吗?

不会,只有 In [1]:

我也遇到了这个情况,有人知道该怎么解决吗,就担心那天突然崩了