How to use C++ with Jupyter-Notebook at Linux
1. Install conda
You can install the mini version: https://docs.conda.io/en/latest/miniconda.html#linux-installers
Or you can install the full version: https://www.anaconda.com/products/individual
‘conda is nothing but another python virtual environment manager’, you can think it like this.
2. Install jupyter-xeus
conda create -n cling
conda activate cling
conda install xeus-cling -c conda-forge
3. Add C++ kernel to jupyter-notebook
I suppose you already have a normal python version of jupyter-notebook installed:
jupyter kernelspec install ~/miniconda3/envs/cling/share/jupyter/kernels/xcpp17 --user
4. Open, Create and Test
Open jupyter-notebook, create a c++ script, run the following codes:
#include <iostream>
std::cout << "Hello World!";