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

macOS 10.13.6下Conda装Jupyter后执行子命令遇段错误11

Conda安装的JupyterLab环境触发Segmentation Fault:11报错

使用以下conda命令创建JupyterLab扩展开发环境:

conda create -n jupyterlab-ext --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=3 cookiecutter nodejs jupyter-packaging

此前连续多日执行该命令均正常,今日创建环境并激活后,运行jlpm触发报错:

~/code$ conda activate myenv
(myenv) ~/code$ jlpm
Segmentation fault: 11

该问题仅在MacBook上出现,WSL2环境仍可正常运行,重启Mac后问题未解决。

补充细节:

  • 实际崩溃的是jupyter本身:无参数运行jupyter正常,执行任何子命令都会触发Segmentation fault:11
  • 段错误发生在导入子命令主模块时,例如执行from notebook.notebookapp import main时崩溃
  • 若创建conda环境时不安装jupyterlab,改用pip install jupyterlab则一切正常
  • pdb显示崩溃点在lib/python3.11/importlib/_bootstrap.py,推测根源是conda提供的jupyter相关包版本冲突或损坏

解决方法

1. 指定Python 3.10版本创建环境

conda-forge近期可能更新了Python 3.11的依赖包,导致兼容性问题。尝试指定Python 3.10版本重新创建环境:

conda create -n jupyterlab-ext-py310 --override-channels --strict-channel-priority -c conda-forge -c nodefaults python=3.10 jupyterlab=3 cookiecutter nodejs jupyter-packaging

2. 清理Conda缓存后重新安装

清理损坏或过时的缓存包,避免影响新环境安装:

conda clean --all -y
conda create -n jupyterlab-ext-new --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=3 cookiecutter nodejs jupyter-packaging

3. 锁定关键Jupyter包版本

如果有之前正常运行的环境,导出其包列表并锁定关键版本安装:

# 导出正常环境的包列表
conda list -n old-working-env > env-packages.txt

查看文件后,在新环境创建时指定notebook、jupyter_core等包的版本,例如:

conda create -n jupyterlab-ext-fixed --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=3 cookiecutter nodejs jupyter-packaging notebook=6.5.4 jupyter_core=5.3.1

4. 使用Mamba替代Conda安装

Mamba的包解析效率更高,能避免部分Conda的安装异常:

# 先在base环境安装mamba
conda install -n base mamba -y
# 用mamba创建环境
mamba create -n jupyterlab-ext-mamba --override-channels --strict-channel-priority -c conda-forge -c nodefaults jupyterlab=3 cookiecutter nodejs jupyter-packaging

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 16:22:46