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

Jupyter Notebook中Panel交互组件无法显示,报jupyter_bokeh模块缺失错误

解决Panel在Jupyter中抛出jupyter_bokeh缺失的问题
  • 安装缺失的依赖包:jupyter_bokeh是Panel在Jupyter环境中渲染Bokeh类交互组件的必需依赖,它和bokeh是两个独立的包。执行以下命令安装:

    pip install jupyter_bokeh
    

    如果你用conda环境,换成:

    conda install -c conda-forge jupyter_bokeh
    
  • 验证环境与安装状态:

    1. 检查当前环境是否真的安装了该包:
      pip list | grep jupyter_bokeh
      
      (conda环境用conda list jupyter_bokeh)
    2. 确认Jupyter Notebook使用的kernel是你安装依赖的Python环境——有时候即使在终端切换了环境,Jupyter可能仍用默认kernel,需要在Notebook中通过Kernel > Change kernel选择对应环境。
  • 重启Jupyter内核:安装完新包后,必须重启Notebook的内核(Kernel > Restart),否则Jupyter无法加载新安装的依赖。

  • 版本兼容性排查:如果安装后仍报错,可能是Panel与jupyter_bokeh版本不兼容。可以尝试指定兼容版本安装,比如针对Panel 1.x系列,安装jupyter_bokeh==3.0.7:

    pip install jupyter_bokeh==3.0.7
    
  • 初始化Panel扩展:在代码开头添加以下语句,确保Panel正确初始化渲染后端:

    import panel as pn
    pn.extension()
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.17 09:10:35