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

Ubuntu 24.04下VSCode中geemap及ipywidgets无法渲染求助

解决Ubuntu 24.04.2 LTS VSCode中geemap/ipywidgets无法渲染的问题

核心问题说明

Ubuntu 24.04默认搭配的Jupyter Notebook版本多为7.x以上,旧版nbextension命令已失效,需改用Jupyter Lab的扩展体系配置交互式组件。


步骤1:更新VSCode及相关扩展

  • 打开VSCode,将Jupyter扩展更新至最新版本
  • 确认当前Python内核为安装了geemap、ipywidgets的环境(VSCode左下角可切换内核)

步骤2:适配新版Jupyter的widgets配置

  1. 先安装Jupyter Lab widgets依赖:
    pip install jupyterlab-widgets
    
  2. 安装ipyleaflet的Lab扩展(若系统无Node.js,先执行sudo apt install nodejs npm):
    jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet
    
  3. 重启VSCode后重新打开Notebook测试

步骤3:修复VSCode渲染设置

  • 打开VSCode设置(快捷键Ctrl+,),搜索Jupyter: Renderers
  • 找到Notebook Widgets选项,将渲染器设为default或jupyter-widgets
  • 关闭并重启VSCode

步骤4:完整重装依赖(可选)

若上述步骤无效,执行完整依赖重装:

pip uninstall -y notebook ipywidgets ipyleaflet geemap jupyterlab-widgets
pip install geemap[all] jupyterlab jupyterlab-widgets

替代方案:直接使用Jupyter Lab

如果VSCode的问题仍无法解决,改用Jupyter Lab直接运行:

  1. 安装Jupyter Lab:
    pip install jupyterlab
    
  2. 启动Jupyter Lab:
    jupyter lab
    
  3. 在浏览器中打开生成的链接,创建Notebook测试geemap和ipywidgets

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.12 17:06:03