美文网首页
Jupyter notebook 内核无效

Jupyter notebook 内核无效

作者: f饭饭f | 来源:发表于2018-08-17 17:32 被阅读0次

    (以python2为例,python3以此类推)
    参考:https://blog.csdn.net/linhai1028/article/details/79544537
    列出可用的kernel,报错如下

    root@a64b41a98807 ~# jupyter kernelspec list
    [ListKernelSpecs] WARNING | Error loading kernelspec 'python2'
    Traceback (most recent call last):
      File "/root/downloa/lib/python2.7/site-packages/jupyter_client/kernelspec.py", line 258, in get_all_specs
        spec = self._get_kernel_spec_by_name(kname, resource_dir)
      File "/root/downloa/lib/python2.7/site-packages/jupyter_client/kernelspec.py", line 201, in _get_kernel_spec_by_name
        return self.kernel_spec_class.from_resource_dir(resource_dir)
      File "/root/downloa/lib/python2.7/site-packages/jupyter_client/kernelspec.py", line 47, in from_resource_dir
        kernel_dict = json.load(f)
      File "/root/downloa/lib/python2.7/json/__init__.py", line 291, in load
        **kw)
      File "/root/downloa/lib/python2.7/json/__init__.py", line 339, in loads
        return _default_decoder.decode(s)
      File "/root/downloa/lib/python2.7/json/decoder.py", line 364, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/root/downloa/lib/python2.7/json/decoder.py", line 380, in raw_decode
        obj, end = self.scan_once(s, idx)
    ValueError: Invalid control character at: line 5 column 19 (char 85)
    No kernels available
    

    先将坏掉的kernel删掉

    root@a64b41a98807 ~# jupyter kernelspec remove python2
    Kernel specs to remove:
      python2 /root/downloa/share/jupyter/kernels/python2
    Remove 1 kernel specs [y/N]: y
    [RemoveKernelSpec] Removed /root/downloa/share/jupyter/kernels/python2
    

    重新安装

    root@a64b41a98807 ~# python2 -m ipykernel install
    Installed kernelspec python2 in /usr/local/share/jupyter/kernels/python2
    

    若是还未下载ipykernel

    root@a64b41a98807 ~# pip2 install ipykernel
    

    相关文章

      网友评论

          本文标题:Jupyter notebook 内核无效

          本文链接:https://www.haomeiwen.com/subject/wsytiftx.html