在 VSCode Insiders 中运行 C++ Jupiter Notebook

Hor*_*man 4 c++ visual-studio-code jupyter-notebook xeus-cling

我已经安装了xeusxeus-clingjupyter 扩展。我将内核更改为 C++ 版本之一,将单元语言更改为 C++,但是当我单击“运行”时,单元永远不会输出。有人可以帮我解决这个问题吗?

abu*_*bua 10

在 vs-code 下运行 xeus-cling

在此输入图像描述

Ceus 在 VS-Code 环境中工作。您必须激活 conda 环境并从中调用 vs-code (我使用 code insiders 版本)。在 Linux 中,这看起来像

conda activate xeus-cling # my env for xeus-cling; where i compiled cling
Run Code Online (Sandbox Code Playgroud)

然后调用项目目录中的代码(内部人员)

code-insiders .& # or code .& if you are using the stable version
Run Code Online (Sandbox Code Playgroud)

如果仍有问题,请尝试以下操作:

  • 从命令行启动 jupyter 笔记本(当然是在上面描述的 conda 环境中)

     jupyter notebook --no-browser
    
    Run Code Online (Sandbox Code Playgroud)

    复制或记住带有标记的行,它看起来像http://127.0.0.1:8888/?token=8daf8f57bef55918defb467defc55f0305803caa27dd01d2

  • 接下来进入code-insiders并点击底部栏Jupyter Server: Remote 在此输入图像描述

  • 在窗口顶部会弹出一个列表,看起来像

在此输入图像描述

  • 选择现有或将令牌复制到其中

  • 现在应该出现一条消息“重新加载内核”,单击按钮即可执行此操作

  • 在底部栏中选择内核,例如 C++14

  • 创建一个新的空白 jupyter 工作表,不要忘记将单元格更改为 C++!