win10+conda 在jupyter notebook中添加c/c++的kernel
最近在准备复试的时候发现如果用jupyter看书写代码会更方便,上网找jupyter写c++代码的方式,一堆问题,乱七八糟,在官方网站上找到了正确的安装方法,记录一下。
One thing that I always found missing in Jupyter Notebook was the support for the C++
language. Of course, the reason it was not supported was that C++ programs have to be
first compiled and then executed unlike Python which is an interpreted language and that’s
why we are able to use it in Python or IPython prompt.
1.开始安装
c和c++是由不同的kernel支持!安装过程中要用conda新建一个虚拟环境,以防止c++的一些包和原来python环境中的一些包产生重复。
1)创建新的虚拟环境,命名为cling,
conda create -n cling
2)激活刚刚创建的环境
conda activate cling
3)在新环境下安装jupyter notebook
conda install jupyter notebook
- 在刚刚安装的环境里面安装 conda-forge
conda install -c conda-forge cling //注意这里的名字是环境名
5)安装完成后看看有没有出现kernel
jupyter kernelspec list
如果出现c++的样子那就是成功了