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

VSCode中Jupyter内核因pyzmq模块启动失败求助

解决Jupyter内核启动时pyzmq模块错误的方案

1. 确认Python环境一致性

  • 检查VSCode左下角显示的当前Python解释器路径,和终端中执行which python(Linux/macOS)或where python(Windows)输出的路径是否一致
  • 若不一致,按下Ctrl+Shift+P(Windows/Linux)或Cmd+Shift+P(macOS),输入Python: Select Interpreter切换到对应环境

2. 彻底重装pyzmq及相关依赖

  • 完全卸载pyzmq:
    pip uninstall -y pyzmq
    
  • 清理pip缓存:
    pip cache purge
    
  • 安装兼容性稳定的pyzmq版本:
    pip install pyzmq==25.1.0
    
  • 更新Jupyter相关核心依赖:
    pip install --upgrade jupyter ipykernel
    

3. 重新注册IPython内核

  • 在目标环境中执行命令注册内核(替换your_env_name为你的环境名称):
    python -m ipykernel install --user --name=your_env_name
    
  • 重启VSCode后,在Jupyter会话中选择刚注册的内核

4. 检查VSCode Jupyter扩展状态

  • 打开VSCode扩展面板,确保Jupyter扩展为最新版本,若不是则点击更新
  • 尝试禁用并重新启用Jupyter扩展,再重启VSCode

5. 虚拟环境问题排查(若使用虚拟环境)

  • 若用conda环境,尝试通过conda安装pyzmq:
    conda install -c conda-forge pyzmq
    
  • 若环境损坏,可重建环境后重新安装依赖:
    conda remove -n your_env_name --all
    conda create -n your_env_name python=3.9
    conda activate your_env_name
    pip install gym_super_mario_bros jupyter pyzmq
    

错误提示原文:
The kernel failed to start due to an error with the 'pyzmq' module. Consider re-installing this module.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 21:27:05