You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac系统VS Code中Jupyter Notebook启动内核失败问题求助

解决Mac VS Code中Jupyter Notebook启动内核失败的问题

以下是针对你遇到的“failed to start kernel”错误的具体排查和解决步骤:

  • 确认Python环境与内核关联

    1. 点击VS Code左下角的Python环境标识,选择你安装了Jupyter的Python环境(不要选系统默认Python,除非该环境已安装Jupyter)。
    2. 打开终端激活对应环境,执行jupyter kernelspec list查看已注册的内核路径,确保VS Code选择的内核指向该环境。
  • 重新注册Jupyter内核
    激活你的Python环境,依次执行以下命令:

    pip uninstall -y ipykernel
    pip install ipykernel
    python -m ipykernel install --user --name=your-env-name  # 替换your-env-name为你的环境名称
    
  • 调整VS Code Jupyter扩展设置

    1. 打开VS Code设置(快捷键Cmd+,),搜索Jupyter: Server Connection Timeout,将值调整为60000(延长超时时间)。
    2. 搜索Jupyter: Kernel Pool Size,设置为1,避免多内核冲突。
    3. 关闭Jupyter: Use Legacy Kernel选项,使用新版内核启动逻辑。
  • 修复权限与缓存问题

    1. 给VS Code添加完全磁盘访问权限:打开「系统设置」→「隐私与安全性」→「完全磁盘访问」,勾选VS Code。
    2. 修复Jupyter目录权限:在终端执行chmod -R 755 ~/.local/share/jupyter。
    3. 清理VS Code缓存:关闭VS Code,删除~/Library/Application Support/Code/Cache和~/Library/Application Support/Code/CachedData目录下的内容,重启VS Code。
  • 更新依赖组件
    在激活的Python环境中执行:

    pip install --upgrade pip
    pip install --upgrade jupyter ipykernel ipython
    

    同时将VS Code、Python扩展、Jupyter扩展更新到最新版本。

内容的提问来源于stack exchange,提问作者Yash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 00:02:37