我正在摆弄linux并尝试使用环境。在这个实验期间,我创建了各种没有任何用途的内核。
source my_environment_name/bin/activate
python -m pip install ipykernel
python -m ipykernel install
python -m ipykernel install --user --name=test_venv
我正在尝试删除旧内核,但我不知道它们存储在哪里,而且我无法弄清楚如何使用终端来执行此操作。我天真地尝试过:
python -m ipykernel uninstall --user --name=test_venv
但这不起作用。如何通过删除旧内核来清理环境?
答案1
找到他们:
/home/solebay/.local/share/jupyter/kernels/env
答案2
使用jupyter kernelspec
命令来管理你的内核:
$ jupyter kernelspec --help
Manage Jupyter kernel specifications.
Subcommands
-----------
Subcommands are launched as `jupyter kernelspec cmd [args]`. For information on
using subcommand 'cmd', do: `jupyter kernelspec cmd -h`.
list
List installed kernel specifications.
install
Install a kernel specification directory.
uninstall
Alias for remove
remove
Remove one or more Jupyter kernelspecs by name.
install-self
[DEPRECATED] Install the IPython kernel spec directory for this Python.
provisioners
List available provisioners for use in kernel specifications.
To see all available configurables, use `--help-all`
$ jupyter kernelspec list
Available kernels:
ch701 /home/jovyan/.local/share/jupyter/kernels/ch701
isis /home/jovyan/.local/share/jupyter/kernels/isis
python3 /opt/conda/envs/isis/share/jupyter/kernels/python3
$ jupyter kernelspec remove ch701
Kernel specs to remove:
ch701 /home/jovyan/.local/share/jupyter/kernels/ch701
Remove 1 kernel specs [y/N]: y
[RemoveKernelSpec] Removed /home/jovyan/.local/share/jupyter/kernels/ch701
$ jupyter kernelspec list
Available kernels:
isis /home/jovyan/.local/share/jupyter/kernels/isis
python3 /opt/conda/envs/isis/share/jupyter/kernels/python3
瞧!