为什么jupyter显示“None not found”?

问题描述:

我想用jupyter编写和编辑python代码。我打开了一个.ipynb文件,但是在右上角看到“无法找到”,我无法执行任何我编写的代码。有什么奇怪的是,我会打开其他.ipynb文件,并没有问题。另外,当我点击红色的“None not found”图标时,我会看到“The'None'内核不可用,请选择另一个合适的内核,或者安装该内核。”我已经安装了Python 3.5.2。我怀疑问题是jupyter没有检测到Python 3内核?它显示“Python [root]”,它应该说“Python 3”。有谁知道如何解决这个问题?为什么jupyter显示“None not found”?

Screenshot of working code

Screenshot "None not found"

+0

这经常发生,例如,当您更新ipynb文件从Jupyter版本3至4。您只需要选择根内核和保存文件。然后再打开它,你应该有新的内核。 –

我怀疑那个特定.ipynb文件包含一些元数据,指定你没有安装内核 - 见the file format specification

如果你打开一个文本编辑器,文件,然后搜索metadata你应该看到的东西看起来像:

{ 
    "metadata" : { 
    "signature": "hex-digest", # used for authenticating unsafe outputs on load 
    "kernel_info": { 
     # if kernel_info is defined, its name field is required. 
     "name" : "the name of the kernel" 
    }, 
    "language_info": { 
     # if language_info is defined, its name field is required. 
     "name" : "the programming language of the kernel", 
     "version": "the version of the language", 
     "codemirror_mode": "The name of the codemirror mode to use [optional]" 
    } 
    }, 
    "nbformat": 4, 
    "nbformat_minor": 0, 
    "cells" : [ 
     # list of cell dictionaries, see below 
    ], 
} 

一个选项是改变内核和语言的条目为空字典,但你可能会发现,这笔记本实际上是一个iR笔记本,或其他几个。

在新安装之前工作的笔记本上全新安装Anaconda后出现同样的问题。我安装了旧版本(3 4.0.0),问题已修复。

我在这里有同样的问题。对我来说,解决办法是:

    在内核菜单
  1. - >更改内核 - >选择Python [根](或 你想要的内核),
  2. 保存文件,
  3. 接近它,
  4. 重新打开它。
+0

这是工作,谢谢! –

更改内核的Python [根] 保存,关闭并重新打开