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

Windows系统中Poetry已安装但无法识别,相关命令执行失败求助

Windows下Poetry已安装但命令无法识别的解决办法

问题描述

Poetry已在Windows系统中完成安装,但执行poetry shell、poetry install等命令时始终无法被识别,报错信息如下:

poetry : The term 'poetry' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1

  • poetry install
  • + CategoryInfo          : ObjectNotFound: (poetry:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
    

已尝试按照官方文档重新安装Poetry并确认是最新版本,但问题依旧存在。

解决步骤

1. 定位Poetry的安装路径

  • 默认安装路径通常为以下其中一个:
    • %APPDATA%\Python\Scripts
    • %USERPROFILE%\AppData\Roaming\Python\Scripts
    • %USERPROFILE%\AppData\Local\pypoetry\Cache\bin
  • 若不确定路径,可在PowerShell中执行where.exe poetry查找;如果命令无输出,手动前往上述目录查找poetry.exe文件。

2. 将路径添加到用户环境变量Path

  • 右键「此电脑」→「属性」→「高级系统设置」→「环境变量」
  • 在「用户变量」区域找到Path变量,点击「编辑」
  • 点击「新建」,将找到的Poetry所在文件夹路径粘贴进去
  • 依次点击「确定」保存所有设置

3. 重启终端窗口

  • 关闭所有已打开的CMD、PowerShell窗口,重新打开后执行poetry --version验证
  • 若能正常显示Poetry版本号,说明问题已解决

4. 临时应急方案

  • 若暂时无法修改环境变量,可直接使用Poetry的完整路径执行命令,示例:
    C:\Users\你的用户名\AppData\Roaming\Python\Scripts\poetry install
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 10:52:37