Posit Workbench启动Jupyter Notebook时报错:找不到jupyter_core.command模块
解决Posit Workbench中Jupyter Notebook启动报错问题
问题详情
- 操作系统:RHL9
- Posit Workbench:已按官方步骤完成安装,无报错
- Python环境路径:
/opt/python/3.11.5/bin/ - 触发场景:尝试启动Jupyter Notebook会话时抛出错误:
Traceback (most recent call last): File "/opt/python/3.11.5/bin/jupyter", line 5, in <module> from jupyter_core.command import main ModuleNotFoundError: No module named 'jupyter_core.command'
- 异常矛盾点:执行
/opt/python/3.11.5/bin/jupyter --version,输出显示jupyter_core已安装(版本5.7.1):
IPython : 8.21.0 ipykernel : 6.29.2 ipywidgets : 8.1.2 jupyter_client : 7.4.9 jupyter_core : 5.7.1 jupyter_server : 1.24.0 jupyterlab : 3.6.5 nbclient : 0.9.0 nbconvert : 7.16.0 nbformat : 5.9.2 notebook : 6.5.6 qtconsole : 5.5.1 traitlets : 5.14.1
可行解决步骤
- 强制重新安装匹配版本的jupyter_core,确保安装路径与当前Python环境绑定:
/opt/python/3.11.5/bin/pip install --force-reinstall jupyter_core==5.7.1 - 检查jupyter启动脚本的有效性:
打开/opt/python/3.11.5/bin/jupyter文件,确认首行shebang为#!/opt/python/3.11.5/bin/python,且from jupyter_core.command import main语句无拼写错误 - 验证Posit Workbench的环境配置:
在Workbench管理界面中确认指定的Python解释器路径为/opt/python/3.11.5/bin/python,避免环境变量冲突导致加载错误的模块路径
内容的提问来源于stack exchange,提问作者Daniel Castro
相关产品推荐
相关产品推荐

