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

Jupyter/终端用conda/pip安装seaborn遇OSError:/bin/fish未找到

解决Jupyter Notebook中conda安装seaborn时的/bin/fish找不到错误

问题根源

报错OSError: "/bin/fish" shell not found的核心原因是:Jupyter的IPython内核执行!前缀命令时,会调用当前用户的默认shell,但你的默认shell仍指向已移除的fish,且内核缓存了旧的shell配置。之前仅从/etc/shells移除fish但未更新默认shell,同时终端pip安装可能未对应Jupyter的运行环境,导致问题未解决。

解决步骤

  • 确认并修改默认shell

    1. 在终端执行命令查看当前默认shell:
      echo $SHELL
      
    2. 如果输出仍是/bin/fish,执行以下命令将默认shell改为bash(或zsh,根据你的偏好):
      chsh -s /bin/bash
      
      执行后需重启终端或重新登录系统,使更改生效。
  • 重启Jupyter Notebook内核
    在Jupyter界面中,点击菜单栏的Kernel -> Restart Kernel,让内核读取新的默认shell配置。

  • 直接指定shell执行conda命令
    若不想修改默认shell,可在Notebook中显式指定用bash执行conda安装命令:

    import sys
    !bash -c "conda install --yes --prefix {sys.prefix} seaborn"
    
  • 确保pip安装对应Jupyter环境
    若选择用pip安装,需在Notebook内执行以下命令,确保安装到Jupyter当前使用的环境中:

    !pip install seaborn
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.07 06:00:48