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

使用Poetry安装openai-whisper提示“No module named 'whisper'”求解决

解决Poetry环境中openai-whisper安装后无法导入的问题

以下是几种可行的安装方法,可逐一尝试:

方法一:使用PyPI官方包安装

  1. 修改pyproject.toml中的依赖配置,将原git仓库依赖替换为PyPI包版本:
    [tool.poetry.dependencies]
    # 保留其他依赖项不变,替换openai-whisper这行
    openai-whisper = "^20231117"
    
  2. 执行依赖更新命令:
    poetry update openai-whisper
    
  3. 激活虚拟环境并验证导入:
    poetry shell
    python -c "import whisper; print(whisper.__version__)"
    

方法二:修复Git仓库安装的构建问题

  1. 清理Poetry缓存,避免旧安装包干扰:
    poetry cache clear --all pypi
    poetry cache clear --all git
    
  2. 重新同步并安装依赖,强制触发包构建:
    poetry install --no-root --sync
    
  3. 验证导入是否正常,执行上述的Python验证命令。

方法三:在Poetry虚拟环境中手动安装

  1. 进入Poetry虚拟环境:
    poetry shell
    
  2. 选择以下任一方式安装:
    • 安装PyPI指定版本:
      pip install openai-whisper==20231117
      
    • 安装Git仓库指定版本:
      pip install git+https://github.com/openai/whisper.git@v20231117
      

额外排查点

  • 确认当前运行的Python环境是Poetry虚拟环境,可通过which python或python --version检查路径与版本是否匹配。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 05:33:13