Jupyter Notebook找不到内核&删去不用的内核

1. 找不到内核

Verify Kernel Installation

  • First, check if the kernel you're trying to use is installed. Open a terminal or command prompt and list the available Jupyter kernels with:
    jupyter kernelspec list 
  • If the kernel is not listed, you need to install it. For example, to install the IPython kernel, you can use:
    pip install ipykernel 
    python -m ipykernel install --user 

Correct the Kernel in the Notebook

  • If the kernel is installed but has a different name than expected, you can change the kernel directly in Jupyter Notebook or JupyterLab by clicking on the "Kernel" menu, then "Change kernel," and selecting the correct kernel.

Ensure Environment Configuration

  • If you're using a virtual environment (like conda or venv), make sure that you've activated the environment before starting Jupyter Notebook. Only then will Jupyter be able to access the kernels installed in that environment.
  • For conda environments, ensure that you've installed ipykernel in the environment and registered the environment's kernel with Jupyter:
    conda activate myenv(我的环境,如torch、TensorFlow) 
    conda install ipykernel 
    python -m ipykernel install --user --name=myenv 
  • Replace myenv with the name of your conda environment.

Reinstall Jupyter Notebook

  • If the issue persists, consider reinstalling Jupyter Notebook in your environment to ensure a clean setup:
    pip uninstall notebook 
    pip install notebook 

2. 删去不用的内核

  1. 查看已安装的内核:首先,您需要知道当前Jupyter安装了哪些内核。打开终端或命令提示符,运行以下命令来列出所有可用的内核:

    jupyter kernelspec list 

    这个命令会列出所有已安装的内核及其安装路径。

  2. 删除不需要的内核:一旦确定要删除的内核名称,使用以下命令来删除它:

    jupyter kernelspec remove kernel_name 

    请将kernel_name替换为您实际想要删除的内核名称。例如,如果您想要删除一个名为python3的内核,命令将是:

    jupyter kernelspec remove python3 

    执行此命令时,系统可能会要求您确认删除操作。根据提示进行确认即可。

  3. 验证内核已被删除:删除内核后,您可以重新运行jupyter kernelspec list命令来确认该内核已从列表中移除。

  • 32
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

filter_hen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值