VSCode 无法将 jupyter 笔记本导出为 html

Mig*_*uel 8 python python-3.x jupyter visual-studio-code jupyter-notebook

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

我正在使用 pip 并已 pip 安装了我能想到的与 jupyter 相关的任何内容: jupyter、jupyterlab、nbconvert、notebook。

有什么想法可能导致这个问题吗?我使用的是 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.

Run Code Online (Sandbox Code Playgroud)

小智 -2

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