当前位置: 首页 > news >正文

Windows11 安装poetry

使用powershell安装


(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

如果使用py运行失败则替换为python即可

终端运行结果如下

D:\AI\A_Share_investment_Agent> (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
Retrieving Poetry metadata# Welcome to Poetry!This will download and install the latest version of Poetry,
a dependency and package manager for Python.It will add the `poetry` command to Poetry's bin directory, located at:C:\Users\phoenix\AppData\Roaming\Python\ScriptsYou can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.Installing Poetry (2.0.1)
Installing Poetry (2.0.1): Creating environment
Installing Poetry (2.0.1): Installing Poetry
Installing Poetry (2.0.1): Creating script
Installing Poetry (2.0.1): DonePoetry (2.0.1) is installed now. Great!To get started you need Poetry's bin directory (C:\Users\phoenix\AppData\Roaming\Python\Scripts) in your `PATH`
environment variable.You can choose and execute one of the following commands in PowerShell:A. Append the bin directory to your user environment variable `PATH`:```
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";C:\Users\phoenix\AppData\Roaming\Python\Scripts", "User")
```B. Try to append the bin directory to PATH every when you run PowerShell (>=6 recommended):```
echo 'if (-not (Get-Command poetry -ErrorAction Ignore)) { $env:Path += ";C:\Users\phoenix\AppData\Roaming\Python\Scripts" }' | Out-File -Append $PROFILE
```Alternatively, you can call Poetry explicitly with `C:\Users\phoenix\AppData\Roaming\Python\Scripts\poetry`.You can test that everything is set up by executing:`poetry --version`

此时如果运行poetry --version

D:\AI\A_Share_investment_Agent> poetry --version
poetry : 无法将“poetry”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径
正确,然后再试一次。
所在位置 行:1 字符: 1
+ poetry --version
+ ~~~~~~+ CategoryInfo          : ObjectNotFound: (poetry:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException

可以发现并没有成功安装,这是因为我们没有添加到环境变量

配置环境变量

1. 在用户变量Path中添加%APPDATA%\Python\Scripts

2. 在系统变量中添加 

检验是否配置成功 

C:\Users\phoenix>poetry --version
Poetry (version 2.0.1)

http://www.lryc.cn/news/528636.html

相关文章:

  • 浅谈Linux 权限、压缩、进程与服务
  • 006 LocalStorage和SessionStorage
  • AJAX RSS Reader:技术解析与应用场景
  • Go优雅实现redis分布式锁
  • 本地部署deepseek模型步骤
  • (2025 年最新)MacOS Redis Desktop Manager中文版下载,附详细图文
  • C++ 写一个简单的加减法计算器
  • 计算机网络基础 - 链路层(3)
  • ray.rllib 入门实践-5: 训练算法
  • FPGA 使用 CLOCK_LOW_FANOUT 约束
  • 选择的阶段性质疑
  • 固有频率与模态分析
  • 数科OFD证照生成原理剖析与平替方案实现
  • CAN总线数据采集与分析
  • SpringSecurity:There is no PasswordEncoder mapped for the id “null“
  • ResNet 残差网络
  • CAPL编程常见问题与解决方案深度解析
  • 信号处理以及队列
  • Linux pkill 命令使用详解
  • react注意事项
  • 【开源免费】基于SpringBoot+Vue.JS在线考试学习交流网页平台(JAVA毕业设计)
  • 怎样在PPT中启用演讲者视图功能?
  • UE AController
  • H264原始码流格式分析
  • JAVA 接口、抽象类的关系和用处 详细解析
  • 反向代理模块b
  • Nuitka打包python脚本
  • pytorch线性回归模型预测房价例子
  • 练习题 - DRF 3.x Caching 缓存使用示例和配置方法
  • 如何解压7z文件?8种方法(Win/Mac/手机/网页端)