Jupyter支持多种编程语言, 每种语言就是一个Kernel。要给Jupyter添加新的Kernel,你需要安装相应的编程语言版本的Kernel。以下以添加Python和R语言Kernel为例说明。
⬇️python⬇️
⚠️:如果你有多个Python环境,可以将每个环境添加为一个Kernel。
1. 先激活你想要的环境,比如你有一个名为“autogen_qhy”的环境,你可以执行:
source activate autogen_qhy
或者
conda activate autogen_qhy
2. 使用 ipykernel 安装该环境的 kernel,执行:
python -m ipykernel install --user --name autogen_qhy --display-name "Python (autogen_qhy)"
这将环境“autogen_qhy”安装为一个新的kernel,名字为 "Python (autogen_qhy)"
3. 启动jupyter notebook:
jupyter notebook
或者你可以选择在指定端口启动:
# 可以不用nohup启动,同时删去nohup 和 &
# 注意:在你需要打开的目录下启动
nohup jupyter notebook --no-browser --port=8889 --ip=* --allow-root &
如果在特定端口打不开网页,欢迎查看解决办法:指定端口打不开网页解决办法
⬇️julia⬇️
1. 启动julia并安装IJulia包:
打开Julia的REPL,在Julia REPL中运行下面的命令来安装IJulia包:
using Pkg;
Pkg.add("IJulia");
2. 启动jupyter notebook:
在Julia REPL中,运行下面的命令,来启动jupyter:
using IJulia;
notebook()
3. 打开jupyter notebook后,你讲看到New按钮里会有一个Julia的内核,这样就成功添加了 Julia Kernel 到 Jupyter Notebook 中。你可以按照类似的步骤添加其他编程语言的 Kernel。