You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jupyter Notebook启动失败:缺失jupyter_server.contents模块及参数错误

解决Jupyter Notebook启动失败、卡顿退出的问题

问题根源

从报错日志来看,存在两个核心问题:

  1. 缺失依赖:ModuleNotFoundError: No module named 'jupyter_server.contents',说明jupyter_server组件未正确安装或版本不匹配
  2. 版本不兼容:TypeError: warn() missing 1 required keyword-only argument: 'stacklevel',旧版notebook的代码调用方式不兼容新版traitlets的参数要求

解决步骤

1. 清理冲突包

打开Anaconda Prompt,执行以下命令卸载相关冲突组件(确保完全清理旧版本):

# 用conda卸载
conda remove --force notebook jupyter_server traitlets
# 若conda清理不彻底,补充用pip卸载
pip uninstall -y notebook jupyter_server traitlets

2. 安装兼容版本组合

安装经过验证的稳定兼容版本,避免版本冲突:

# Conda安装推荐组合
conda install notebook=6.5.6 jupyter_server=2.7.0 traitlets=5.9.0

# 若Conda安装失败,改用Pip安装
pip install notebook==6.5.6 jupyter_server==2.7.0 traitlets==5.9.0

3. 验证路径与启动

先确认当前使用的Python/Pip属于Anaconda环境,避免全局环境干扰:

# Windows系统查看路径
where python
where pip

# Linux/macOS系统查看路径
which python
which pip

确保输出路径指向Anaconda安装目录(如C:\Users\HP\anaconda3\python.exe),之后启动Jupyter Notebook:

jupyter notebook

额外注意事项

如果你的系统同时存在全局Python环境和Anaconda环境,建议避免直接用pip安装包(除非激活了Anaconda环境),防止不同环境的包互相干扰。

内容的提问来源于stack exchange,提问作者Tkay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 21:32:48