【问题标题】:VSCode fails to export jupyter notebook to htmlVSCode 无法将 jupyter notebook 导出到 html
【发布时间】:2021-02-08 14:58:14
【问题描述】:

我在 VSCode 中有一个 jupyter 笔记本,我正在尝试使用 VSCode 中的内置按钮将其导出为 html,但是我不断收到此错误消息,提示找不到“jupyter-nbconveter”。

我正在使用 pip 并且 pip 安装了任何与 jupyter 相关的东西:jupyter、jupyterlab、nbconvert、笔记本。

任何想法可能导致问题?我使用的是 Windows 10。

> C:\Python38\python.exe c:\Users\Toshiba\.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\pyvsc-run-isolated.py jupyter nbconvert --version
> C:\Python38\python.exe c:\Users\Toshiba\.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\pyvsc-run-isolated.py jupyter nbconvert --version
Error 2020-10-26 10:40:19: Export failed [r [Error]: Traceback (most recent call last):
  File "c:\Users\Toshiba\.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\pyvsc-run-isolated.py", line 26, in <module>
    runpy.run_module(module, run_name="__main__", alter_sys=True)
  File "C:\Python38\lib\runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "C:\Python38\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Toshiba\AppData\Roaming\Python\Python38\site-packages\jupyter.py", line 4, in <module>
    main()
  File "C:\Users\Toshiba\AppData\Roaming\Python\Python38\site-packages\jupyter_core\command.py", line 247, in main
    command = _jupyter_abspath(subcommand)
  File "C:\Users\Toshiba\AppData\Roaming\Python\Python38\site-packages\jupyter_core\command.py", line 133, in _jupyter_abspath
    raise Exception(
Exception: Jupyter command `jupyter-nbconvert` not found.

【问题讨论】:

  • 在 VSCode 终端输入“jupyter nbconvert --version”时是否输出其版本号?由于 VSCode 中的 Jupyter notebook 功能是由 python 扩展提供的,因此建议您使用最新版本的 python 扩展或尝试其他版本的 python 扩展。
  • 当我在 VSCode 终端中键入时,我收到以下错误 jupyter : The term 'jupyter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 我还安装了最新版本的 VSCode Python 扩展 2020.9.114305。在他们的 github 上提出问题会更好吗?
  • 你可以试试“python -m notebook”,尝试使用不同的VSCode环境。

标签: python python-3.x visual-studio-code jupyter-notebook jupyter


【解决方案1】:

您正在使用 jupyter 扩展,但您没有在 python 解释器中安装 jupyter。只需“pip install jupyter”,导出即可。 如果你使用的是 venv 或其他虚拟环境,你应该在那里安装 jupyter。

【讨论】:

  • 嗨,艾略特!在发布答案时,请正确格式化您的代码。你可以阅读更多关于它here
  • 谢谢! Elliot 写的解决方案很完美。
猜你喜欢
  • 1970-01-01
  • 2020-12-21
  • 2020-01-25
  • 2023-03-06
  • 2020-11-09
  • 2020-07-13
  • 2021-07-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多