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

Jupyter执行!python命令提示zsh:1: command not found: python问题求助

解决Jupyter中!python命令找不到的问题
  • 排查路径匹配问题
    在Jupyter代码单元中运行以下命令,获取当前环境的Python实际路径:

    !which python
    !which python3
    import sys
    print(sys.executable)
    

    将报错命令里的python替换为上述输出的路径,比如sys.executable输出/usr/local/bin/python3.10,则修改命令为:

    !/usr/local/bin/python3.10 -m spacy init fill-config /Users/atharvasankhe/Files/resumeparse/data/training/base_config.cfg config.cfg
    

    也可以直接尝试用python3替代python:

    !python3 -m spacy init fill-config /Users/atharvasankhe/Files/resumeparse/data/training/base_config.cfg config.cfg
    
  • 使用当前内核的Python执行(最稳妥)
    利用sys.executable调用Jupyter当前内核对应的Python解释器,彻底避免环境差异问题:

    import sys
    !{sys.executable} -m spacy init fill-config /Users/atharvasankhe/Files/resumeparse/data/training/base_config.cfg config.cfg
    
  • 检查虚拟环境(若使用)
    如果是在虚拟环境中安装的Jupyter,务必在启动Jupyter前激活该虚拟环境,确保shell命令默认使用虚拟环境内的Python。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.06 18:11:03