添加虛擬python內核到jupyter
$source SciPyEnv/bin/activate
(SciPyEnv)$python -m ipykernel install --user --name=scipyEnv
接下來你就能看到jupyter可以調用虛擬內核了
本地jupyter的內核查看
$jupyter kernelspec list
Available kernels:
python3 /home/blacklee/.local/share/jupyter/kernels/python3
SciPyEnv /home/blacklee/.local/share/jupyter/kernels/scipyenv
可以看到實際上是在之前文件夾新增了virtualEnv配置文件夾,目錄如下
.
├── python3
│ ├── kernel.json
│ ├── logo-32x32.png
│ └── logo-64x64.png
└── scipyenv
├── kernel.json
├── logo-32x32.png
└── logo-64x64.png
kernel文件的內容:
{
"argv": [
"/home/blacklee/PyEnvs/SciPyEnv/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "SciPyEnv",
"language": "python"
}
刪除kernel
jupyter kernelspec uninstall SciPyEnv