首页 > 解决方案 > 我的 jupyter 笔记本是笔记本不工作

问题描述

(base) C:\Users\deves>conda install jupyter nb_conda ipykernel
Collecting package metadata (current_repodata.json): done
Solving environment: done

套餐计划

环境位置:C:\Users\deves\anaconda3

添加/更新规格:

将安装以下新软件包:

  nb_conda           pkgs/main/win-64::nb_conda-2.2.1-py38_1
  nb_conda_kernels   pkgs/main/win-64::nb_conda_kernels-2.3.1-py38haa95532_0


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: - Enabling nb_conda_kernels...
CONDA_PREFIX: C:\Users\deves\anaconda3
Status: enabled

| Config option `kernel_spec_manager_class` not recognized by `EnableNBExtensionApp`.
Enabling notebook extension nb_conda/main...
      - Validating: ok
Enabling tree extension nb_conda/tree...
      - Validating: ok
Config option `kernel_spec_manager_class` not recognized by `EnableServerExtensionApp`.
Enabling: nb_conda
- Writing config: C:\Users\deves\anaconda3\etc\jupyter
    - Validating...
      nb_conda 2.2.1 ok

done
ERROR conda.core.link:_execute(698): An error occurred while installing package 'defaults::nb_conda_kernels-2.3.1-py38haa95532_0'.
Rolling back transaction: done

LinkError: post-link script failed for package defaults::nb_conda_kernels-2.3.1-py38haa95532_0
location of failed script: C:\Users\deves\anaconda3\Scripts\.nb_conda_kernels-post-link.bat
==> script messages <==
Enabling nb_conda_kernels...
CONDA_PREFIX: C:\Users\deves\anaconda3
Status: enabled

==> 脚本输出 <==

stdout:
stderr: 'chcp' is not recognized as an internal or external command,
operable program or batch file.
'chcp' is not recognized as an internal or external command,
operable program or batch file.
'chcp' is not recognized as an internal or external command,
operable program or batch file.

return code: 1

()


(base) C:\Users\deves>

(base) C:\Users\deves>jupyter notebook
[C 12:05:35.041 NotebookApp] Bad config encountered during initialization: The 'kernel_spec_manager_class' trait of <notebook.notebookapp.NotebookApp object at 0x0000022CC9114F10> instance must be a type, but 'nb_conda_kernels.CondaKernelSpecManager' could not be imported.

请通过卸载和重新安装帮助尝试了很多,但这不起作用。

标签: pythonjupyter-notebookanaconda3

解决方案


  1. 你应该找到文件jupyter_config.json,它的路径可能像这样 'C:\Users\mi.conda\envs\pytorch_1.7_cpu\etc\jupyter' 然后,删除

     "kernel_spec_manager_class": "nb_conda_kernels.CondaKernelSpecManager"
    

    remove 删除它,包括上面存在的逗号。

  2. 删除了以下三个文件夹(尽管您可能需要进行一些备份...)

    ~/.jupyter

    ~/.ipython

    ~/.local/share/jupyter

(这里我删除了除“kernels”子文件夹之外的所有内容)

  1. 我运行了以下 4 条指令:

    jupyter nbextension install --user --py widgetsnbextension

    jupyter nbextension install --user --py bqplot

    jupyter nbextension 启用 --user --py widgetsnbextension

    jupyter nbextension 启用 --user --py bqplot


推荐阅读