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

PowerShell中Poetry提示‘No Python at "D:\python.exe’如何修复?

解决Poetry提示找不到Python路径的问题

一、手动指定Poetry关联的Python环境

  1. 先确认当前Python的实际路径,在PowerShell中执行:
    where python
    
    会输出你当前可用的Python安装路径(比如 C:\Users\你的用户名\AppData\Local\Programs\Python\Python312\python.exe)
  2. 让Poetry使用这个路径的Python,执行:
    poetry env use 你的Python实际路径
    
    示例:poetry env use C:\Users\Owen\AppData\Local\Programs\Python\Python312\python.exe
  3. 验证是否修复:执行poetry --version

二、卸载重装Poetry重置环境

如果上面的方法无效,完全可以卸载后重装Poetry:

  1. 卸载Poetry,在PowerShell中执行:
    (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - --uninstall
    
  2. 重装Poetry,执行:
    (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
    
  3. 重装完成后,再次执行poetry --version,Poetry会自动关联当前可用的Python

三、额外检查项

  • 确认Python已添加到系统环境变量:执行echo $env:PATH,查看输出中是否包含Python的安装目录和其下的Scripts子目录
  • 若修改环境变量后仍有问题,重启PowerShell再尝试

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.09 11:37:03