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配置
- 先安装Jupyter Lab widgets依赖:
pip install jupyterlab-widgets - 安装ipyleaflet的Lab扩展(若系统无Node.js,先执行
sudo apt install nodejs npm):jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-leaflet - 重启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直接运行:
- 安装Jupyter Lab:
pip install jupyterlab - 启动Jupyter Lab:
jupyter lab - 在浏览器中打开生成的链接,创建Notebook测试
geemap和ipywidgets
内容的提问来源于stack exchange,提问作者user28994658
相关产品推荐
相关产品推荐

