Windows系统安装Poetry报错:.Content was unexpected at this time
解决Windows安装Poetry报错
.Content was unexpected at this time. 问题场景
在Windows系统中执行Poetry官方提供的安装命令:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
此前能正常运行,现在触发错误:
C:\Project_Files\project>(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - .Content was unexpected at this time.
解决方法
- 检查终端类型:该命令是PowerShell专属语法,如果在CMD(命令提示符)中执行会出现此错误,必须切换到PowerShell环境。
- 切换终端重新执行:
- 按下
Win + X,选择「Windows PowerShell」或「终端」(Windows 11及以上版本)。 - 直接复制执行官方安装命令即可。
- 按下
- 替代安装步骤(若直接执行命令仍有问题):
- 单独下载安装脚本:
Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing -OutFile install-poetry.py - 运行脚本完成安装:
py install-poetry.py
- 单独下载安装脚本:
内容的提问来源于stack exchange,提问作者Lakshay Rohilla
相关产品推荐
相关产品推荐

