Cling是一个交互式C++运行环境,这里安装是用于在jupyter notebook中编写C++代码。
提示:
1. 本主题的安装方法需要python2版本,请自行设置python的运行环境。
2. 不像编译安装,请直接下载对应系统的编译好的二进制文件。
- 从github克隆代码库
git clone https://github.com/root-project/cling.git
- 执行安装
- 解压缩后,进入如下目录执行cpt.py
- ./cling/tools/packaging
./cpt.py --check-requirements && ./cpt.py --create-dev-env Debug --with-workdir=./cling-build/
- 安装cling的kernel
- 切换到cling/tools/Jupyter/目录下安装。
pip3 install kernel/
- 添加cling kernel到jupyter
- 目前为止cling内核支持的C++版本可以选择安装,版本如下:
1.cling-cpp11:C++11标准
2.cling-cpp14:C++14标准
3.cling-cpp17:C++17标准
- 目前为止cling内核支持的C++版本可以选择安装,版本如下:
jupyter kernelspec install kernel/cling-cpp17
- 附录:
- 上述安装需要安装如下工具:
(1). clang与llvm编译器与编译后台;
(2). 安装git工具;
(3). 安装cmake工具;
- 可以愉快的在jupyter下做C++文档了。
-
配置好的结果:
附录:
- cling的编译好的下载链接:
https://root.cern.ch/download/cling/
- cling的安装等再官网有非常详细的教程:
https://github.com/root-project/cling