更新 - 找到了解决方案,请参阅评论,有关更多详细信息的评论,
我正在使用vs代码中的jupyter笔记本,并尝试通过该笔记本将笔记本导出到HTML
笔记本菜单选项卡
换句话说,我正在按照此页面
我正在遇到此错误(在“输出”的末尾, ),当试图将jupyter笔记本导出到html或pdf:
Jupyter command `jupyter-nbconvert` not found.
at a.executeCommand (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1000940)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async a.export (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1007072)
at async _.exportToFormat (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1015303)
at async _.performNbConvertExport (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1014517)
at async _.performExport (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1014153)
at async _.exportImpl (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1013602)
at async _.export (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1013335)
at async b.export (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:62972)
at async o._executeContributedCommand (c:\Users\EJJ\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:83:31325)]
我的sys.path是:
['c:\\Users\\EJJ\\Documents\\Python',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\python310.zip',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\DLLs',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\lib',
'C:\\Users\\EJJ\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0',
'',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\Scripts',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\win32',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\win32\\lib',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\Pythonwin',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\lib\\site-packages',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\nbconvert',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\nbconvert\\exporters']
我认为安装的nbconvert软件包是:
C:\Users\EJJ\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\nbconvert
我认为这是我的sys.path中的第三位。
我的问题似乎与这个问题有些相似:
由于与问题的相似性,我试图遵循该线程中给出的建议。我发现通过运行以下命令来导出:
python -m jupyter nbconvert --to HTML Unitled-1.ipynb
也不适用于安装。我没有获得HTML文件,而是列出了一些选项,并且
Jupyter command 'jupyter-nbconvert' not found
我还尝试了以下步骤:
- 卸载NBConvert,并使用PowerShell作为管理员
- 卸载jupyter进行重新安装,并使用PowerShell作为管理员作为管理员来重新
- 安装以下命令
setx PATH "%PATH%;C:\Users\EJJ\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts"
:提供有关我安装的更多信息,我运行了命令 python -m jupyter -version
。这产生了:
Selected Jupyter core packages...
IPython : 8.3.0
ipykernel : 6.13.0
ipywidgets : 7.7.0
jupyter_client : 7.3.1
jupyter_core : 4.10.0
jupyter_server : not installed
jupyterlab : not installed
nbclient : 0.6.3
nbconvert : 6.5.0
nbformat : 5.4.0
notebook : 6.4.11
qtconsole : 5.3.0
traitlets : 5.2.1.post0
最后,我只是想收集一些描述同一问题的帖子,因为我怀疑它们没有解决。希望从本期中的任何学习都可以帮助解决这些问题:
https://github.com/ microsoft/vscode-jupyter/issues/4347
VSCode fails to export jupyter notebook to html
https://github.com/microsoft/vscode-jupyter/issues/issues/10096 (解决方案在这里,请参阅注释)
解决方案
在VSCODE中,按Ctrl+Shift+P(默认设置)打开“命令调色板”(也在“ view” -tab下找到)
写 jupyter:选择“解释器”以在字段中启动jupyter server
选择Python的另一个版本(在我的情况下Windows Store-请参见
UPDATE - A solution was found, see comments, and the end of this post for further details
I am using Jupyter Notebook in VS Code, and trying to export my notebook to HTML through the
Notebook menu tab
In other words, I am following the instructions from this page
I am getting this error (in the end of "Output"), when trying to export a Jupyter Notebook to HTML or PDF:
Jupyter command `jupyter-nbconvert` not found.
at a.executeCommand (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1000940)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async a.export (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1007072)
at async _.exportToFormat (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1015303)
at async _.performNbConvertExport (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1014517)
at async _.performExport (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1014153)
at async _.exportImpl (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1013602)
at async _.export (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:1013335)
at async b.export (c:\Users\EJJ\.vscode\extensions\ms-toolsai.jupyter-2022.4.1021342353\out\extension.node.js:2:62972)
at async o._executeContributedCommand (c:\Users\EJJ\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:83:31325)]
My sys.path is:
['c:\\Users\\EJJ\\Documents\\Python',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\python310.zip',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\DLLs',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\lib',
'C:\\Users\\EJJ\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0',
'',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\Scripts',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\win32',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\win32\\lib',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\Pythonwin',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0',
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\\lib\\site-packages',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\nbconvert',
'c:\\Users\\EJJ\\.vscode\\extensions\\ms-toolsai.jupyter-2022.4.1021342353\\pythonFiles\\vscode_datascience_helpers\\getVariableInfo',
'C:\\Users\\EJJ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python310\\site-packages\\nbconvert\\exporters']
and the nbconvert package I think is installed at:
C:\Users\EJJ\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\nbconvert
, which I find to be third from the bottom in my sys.path.
My issue seems somewhat similar to this issue:
VScode fails to export Jupyter notebook to HTML - 'jupyter-nbconvert` not found
Because of the similarity to the issue, I have tried to follow the suggestions given in that thread. I found that exporting by running the following command:
python -m jupyter nbconvert --to HTML Unitled-1.ipynb
did also not work for my installation. Instead of getting an HTML file, I got some options listed, and the error message
Jupyter command 'jupyter-nbconvert' not found
I also tried the following steps:
- Uninstalling nbconvert, and reinstalling using PowerShell as administrator
- Uninstalling Jupyter, and reinstalling using PowerShell as administrator
- Running the following command:
setx PATH "%PATH%;C:\Users\EJJ\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts"
To try and give some more information about my installation, I ran the command python -m jupyter --version
. This produced:
Selected Jupyter core packages...
IPython : 8.3.0
ipykernel : 6.13.0
ipywidgets : 7.7.0
jupyter_client : 7.3.1
jupyter_core : 4.10.0
jupyter_server : not installed
jupyterlab : not installed
nbclient : 0.6.3
nbconvert : 6.5.0
nbformat : 5.4.0
notebook : 6.4.11
qtconsole : 5.3.0
traitlets : 5.2.1.post0
In the end, I just wanted to gather some posts which describes the same issue, since I suspect them to not be resolved. Hopefully, any learnings from this issue might help resolve those:
https://github.com/microsoft/vscode-jupyter/issues/4347
VScode fails to export Jupyter notebook to HTML - 'jupyter-nbconvert` not found
VSCode fails to export jupyter notebook to html
Unable to convert Jupyter Notebooks into python scripts Jupyter command `jupyter-nbconvert` not found
https://github.com/microsoft/vscode-jupyter/issues/10096 (The solution is here, see comments)
Solution
In VScode, press CTRL+Shift+P (default setting) to open "Command Palette" (also found under "View"-tab)
Write Jupyter : Select interpreter to start Jupyter server
in the field
Choose the other version of python (Windows Store in my case - see
)
Try to export again, and say yes to installing Jupyter again if VSCode asks to.
发布评论
评论(2)
您可以尝试使用此命令:
jupyter:选择解释器启动jupyter服务器
并选择已安装NBConvert的Python环境。另外,您可以将NBConvert安装到我们用来运行笔记本的环境中。应该是这个:
You might try using this command:
Jupyter : Select interpreter to start Jupyter server
and pick the python environment where you have nbconvert installed.Alternatively you could install nbconvert into the environment we're using to run your notebook. It should be this one:
您可以在VSCODE中使用导出工具将其转换为PDF。
有关更多信息,请访问此链接
You can use the export tool in vscode to convert it to pdf.

For more info go to this link