文章目录
- 1. 一般是缺少依赖项或配置问题
- 1.1.检查运行环境:
- 1.2. 安装`nbconvert`。
- 1.3.`jupyter --version`查看还是没有,卸载重新安装。
- 1.4. 还有安装,继续卸载重新安装
- 1.4.1.如果删除后还是报已经存在,删除对应文件夹
- 1.5.`jupyter --version`查看还是没有,卸载重新安装多次还是不行。
- 1.6.修改nbconvert版本
- 2. 尝试重新安装 Jupyter Notebook 。
- 3.重新创建一个conda环境重开。
- 3.1 创建环境
- 3.2.安装jupyter
- 1.配置密码
- 3.3. jupyter添加conda环境
- 3.4. 启动jupyter
打开jupyter notebook报错500:Internal Server Error。
一般是缺少依赖项或配置问题: Jupyter Notebook 可能缺少必要的依赖项或配置不正确。
1. 一般是缺少依赖项或配置问题
1.1.检查运行环境:
确保正在使用正确的 Python 环境并且所需的依赖项已经安装
jupyter --version
命令查看
发现缺少nbconvert
。
1.2. 安装nbconvert
。
pip install nbconvert
发现已经安装了。
1.3.jupyter --version
查看还是没有,卸载重新安装。
- 卸载
pip uninstall nbconvert
- 重新安装
pip install nbconvert
发现还有一个。
1.4. 还有安装,继续卸载重新安装
- 继续卸载
- 重新安装
1.4.1.如果删除后还是报已经存在,删除对应文件夹
1.5.jupyter --version
查看还是没有,卸载重新安装多次还是不行。
1.6.修改nbconvert版本
pip install -U nbconvert== 7.6.0 --user
(随便试了一个版本,报错了然后告诉所有的版本了。)
一般到这儿安装好缺少的jupyter依赖项或配置就结束了,就可以打开jupyter了。
2. 尝试重新安装 Jupyter Notebook 。
Jupyter找不到依赖项,安装也不成功。检查其依赖项安装失败。尝试重新安装 Jupyter Notebook 。
pip uninstall jupyter
pip uninstall notebook
环境乱了。。。重新创建了一个新环境真香。
3.重新创建一个conda环境重开。
3.1 创建环境
conda create -n python39 python=3.9
- conda其他命令:
# 克隆环境
conda create -n B --clone A (B代表新环境名,A原环境名)
# 升级python版本
conda install python=3.10# 除conda环境
conda remove -n 环境名 --all
# 也可以conda info -e后,进入目录直接移除rm对应的环境# 配置国内源下载
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/ && pip config set install.trusted-host mirrors.aliyun.com
3.2.安装jupyter
# 安装
pip install jupyter
pip install notebook
jupyter notebook password # 设置密码
1.配置密码
ipython
[1]: from jupyter_server.auth import passwd;
[2]: passwd()
# 输入你自己设置登录Jupyter界面的密码。
'sha1:b92f3fb7d848:a5d40ab2e26aa3b296ae1faa17aa34d3df351704'# 将生成的字符串写入配置文件。jupyter-notebook --generate-config # 生成对应的配置文件,打开生成的配置文件
c.ServerApp.password = u'sha1:b92f3fb7d848:a5d40ab2e26aa3b296ae1faa17aa34d3df351704'
3.3. jupyter添加conda环境
#1.进入想要添加到jupyter 的环境
conda info -e (显示当前已有的环境)
conda activate 环境名(进入环境)想要显示的环境
#2.pip install ipykernel 安装ipykernel
python -m ipykernel install --user --name 加入环境名称 --display-name "显示环境名称"
#例:python -m ipykernel install --user --name python39 --display-name "python39"
#进入jupyter查看是否成功
3.4. 启动jupyter
# 服务器启动,后面的参数可根据实际情况使用,端口根据自己主机情况而定
jupyter-notebook
(jupyter-notebook --ip 0.0.0.0 --port 9643 --allow-root --no-browser)