简体   繁体   English

VSCode 中的 Jupyter 笔记本未显示最新的 Python 内核列表

[英]Jupyter notebooks in VSCode not showing up to date python kernel list

For a couple of months I've had issues with working with virtual envs, python notebooks & jupyter in VSCode, for some reason, a lot of the time, it cannot find kernels I added, even though I can see them when running jupyter kernelspec list .几个月来,我在 VSCode 中使用虚拟环境、python 笔记本和 jupyter 时遇到问题,出于某种原因,很多时候,它找不到我添加的内核,即使我在运行jupyter kernelspec list时可以看到它们jupyter kernelspec list It seems random whether they appear or not.它们出现与否似乎是随机的。 Reloading the screen and restarting vscode does not help, neither does disabling and re-enabling the python and jupyter extensions.重新加载屏幕并重新启动 vscode 没有帮助,禁用和重新启用 python 和 jupyter 扩展也没有帮助。 I tried both from the button, select kernel and through the command palette.我从按钮、选择内核和命令面板都尝试过。 I usually start vscode from the command line, with my virtual environment activated.我通常从命令行启动 vscode,并激活我的虚拟环境。 Moreover, a lot of kernels which I've deleted a long time ago still show up in the list.此外,我很久以前删除的许多内核仍然出现在列表中。 Vscode and laptop are both up to date. Vscode 和笔记本电脑都是最新的。 I've had issues with the integrated jupyter notebooks before, at first formatting and autocomplete didn't work in the notebook (but they did in regular python files).我之前在集成的 jupyter 笔记本上遇到过问题,起初格式化和自动完成在笔记本中不起作用(但它们在常规 python 文件中起作用)。 I'm on MacOS, if that matters.我在 MacOS 上,如果这很重要的话。

Sorry to tell that this is a bug, see bug report: Can't see or select Jupyter kernel's from Kernel drop-down很抱歉,这是一个错误,请参阅错误报告:无法从内核下拉列表中查看或选择 Jupyter 内核

And now there's a workaround that:现在有一个解决方法:

  • Find where python is installed查找python的安装位置
  • Select the command Python: Select Interpreter选择命令 Python:选择解释器
    • Next select Enter interpreter path接下来选择输入解释器路径
    • Next enter the path into the input box and hit Enter接下来在输入框中输入路径并按 Enter

This interpretr will now work in VS Code and you might need to re-load VS Code just once more to get it working in jupyter extension.这个解释器现在可以在 VS Code 中工作,你可能需要再次重新加载 VS Code 才能让它在 jupyter 扩展中工作。

Please have a try.请试一试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM