python - 我的 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
添加/更新规格:
- ipykernel
- 朱庇特
- nb_conda
将安装以下新软件包:
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.
请通过卸载和重新安装帮助尝试了很多,但这不起作用。
解决方案
你应该找到文件
jupyter_config.json
,它的路径可能像这样 'C:\Users\mi.conda\envs\pytorch_1.7_cpu\etc\jupyter' 然后,删除"kernel_spec_manager_class": "nb_conda_kernels.CondaKernelSpecManager"
remove 删除它,包括上面存在的逗号。
删除了以下三个文件夹(尽管您可能需要进行一些备份...)
~/.jupyter
~/.ipython
~/.local/share/jupyter
(这里我删除了除“kernels”子文件夹之外的所有内容)
我运行了以下 4 条指令:
jupyter nbextension install --user --py widgetsnbextension
jupyter nbextension install --user --py bqplot
jupyter nbextension 启用 --user --py widgetsnbextension
jupyter nbextension 启用 --user --py bqplot
推荐阅读
- javascript - 正则表达式捕获内联数学公式,例如:python 或 javascript 中的 $ inline $
- rule-engine - CodeEffects 规则编辑器在保存规则时抛出异常“没有找到“token”属性的“[NULL]”值的方法”
- javascript - 使用 HTML 和 JS 将 HTML 从一个文件导入到另一个文件?
- .net - 如何更新另一个线程上的控件?
- angular - 为什么我在使用 Postman 和 Angular HttpClient 时得到不同数量的响应标头?
- python - 如何在普通控制台模式下使用 structlog 对键:值对进行排序?
- php - 从 foreach 循环中断行
- mysql - 如何使用“#”作为 SQL 中的列名
- excel - 使用 docx4j 库实现重新保存时 Excel 大小减小
- javascript - 由于自动签名证书,Kurento 媒体服务器未录制