jupyter c++/python/js/ts
jupyter notebook和juypter lab 对windows c++ kernel都支持的不好:
https://github.com/jupyter/jupyter/wiki/Jupyter-kernels
如果要用(cling 或者xeus-cling),只能选中*nix平台, 测试windows wsl也可以,步骤如下
1.安装wsl
2.装miniconda,不要装anaconda(里面的zmq会和cling冲突)
3.安装python包
conda install -c conda-forge jupyterlab conda install -c conda-forge xeus-cling conda install -c conda-forge boost
4.配置jupyter lab
jupyter lab --generate-config
jupyter_lab_config.py 内容:(密码abc123)
c.NotebookApp.notebook_dir = '/mnt/d/jupyter' c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.password = 'sha1:9fb88efadb70:8cb38c269297edbbc6a02f5b11ad8d346e2b9fdd' c.NotebookApp.open_browser = False c.NotebookApp.port = 33333 c.NotebookApp.allow_remote_access = True
5.如果有权限问题:
chmod 777 /home/wyt/.jupyter/jupyter_lab_config.py
chmod 777 /home/wyt/.condarc
6.重启一下wsl(wsl -t debian),不会的话重启电脑
7.运行:jupyter-lab
8.几个测试代码
#include <stdio.h> printf("hello, world.\n");
#include <boost/format.hpp> #include <boost/tokenizer.hpp> #include <boost/algorithm/string.hpp> #include <boost/algorithm/string/join.hpp> std::vector<std::string> cmdarray; boost::split(cmdarray, "abc def.123;456", boost::is_any_of(" .,:;"), boost::token_compress_on); std::cout << "output size: " << cmdarray.size() << std::endl;