且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jupyter notebook/由于KeyError无法启动内核

更新时间:2022-05-13 23:36:45

在我的情况下,此问题源自jupyter-consoleipython中的prompt-toolkit需求冲突.

In my case, the issue originated from having prompt-toolkit requirement conflict in jupyter-console and ipython.

您可以使用pip check来确定是否存在相同的问题.如果输出与下面的输出类似,则必须修复损坏的程序包问题.

You can use pip check to make sure whether you have the same problem. If the output is something similar to my output below, you have to fix the broken packages issue.

>>> pip check ipython 
ipython 5.0.0 has requirement prompt-toolkit<2.0.0,>=1.0.3, but you'll have prompt-toolkit 2.0.9 which is incompatible. 

>>> pip check jupyter-console 
jupyter-console 6.0.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.

快速解决方案是尝试在此处

The quick fix is to try the solution originally mentioned here.

pip uninstall prompt-toolkit 
pip install prompt-toolkit==1.0.15 
pip uninstall jupyter-console 
pip install jupyter-console==5.2.0