【问题标题】:Jupyter Notebook not handling properly .js elements in VS CodeJupyter Notebook 无法正确处理 VS Code 中的 .js 元素
【发布时间】:2019-12-27 01:07:47
【问题描述】:

在 VSC 中使用 Jupyter Notebook“本机”支持时,某些数据/值表示会按预期工作,但似乎 JavaScript 元素未正确表示或预览。

当我尝试在 VS Code 中将 Map (gmaps) 作为图形获取时,我得到 Figure(layout=FigureLayout(height='420px')) 而当我在 Chrome 浏览器内的 Jupyter Notebook/Lab 服务器中执行相同的代码块时,我得到想要的输出告诉我我的外部设置应该没问题。我正在使用 jupyter-js-widgets 和 jupyter-gmaps 扩展。

我感觉我在 VS Code 中缺少一些关于 JavaScript 的额外配置。

我的 VS Code 关于:

我的 Jupyter 版本

谢谢

【问题讨论】:

    标签: python visual-studio-code jupyter-notebook jupyter-lab gmaps.js


    【解决方案1】:

    @MatejZ。目前大多数基于小部件的 Jupyter 扩展在 VSCode Notebook Editor 和 Interactive Window 中不起作用。但是,我们正在考虑为此添加更多支持,因为它是一个非常需要的功能。如果您愿意,可以在此处跟踪我们的 GitHub 问题以获得此支持(我们已经开始研究): https://github.com/microsoft/vscode-python/issues/3429

    【讨论】:

      【解决方案2】:

      临时解决方案是添加如下内容:

      # create html
      from ipywidgets.embed import embed_minimal_html
      embed_minimal_html('export.html', views=[fig], title = 'Gmap output')
      

      它将获取对象“fig”并使其通过“export.html”页面访问。

      感谢@Ian Huff 指出问题 :) 问题中提到了 Webview,它可以与临时解决方案结合使用。但是,我现在很满意。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-08-09
        • 2019-05-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-17
        • 2021-12-27
        相关资源
        最近更新 更多