全新Windows10设备安装Poetry报错:No pyvenv.cfg file
解决Poetry安装失败(No pyvenv.cfg file)的方案
第一步:卸载微软商店版Python
- 打开设置 → 应用 → 应用和功能,找到Python 3.8(来自Microsoft Store),点击卸载。
第二步:安装官方版Python 3.8
- 下载Python 3.8的官方Windows可执行安装包(优先选3.8分支的稳定最终版,比如3.8.10)
- 安装时必须勾选Add Python 3.8 to PATH,选择自定义安装并勾选“Install for all users”,避免权限和路径识别问题。
第三步:验证Python安装
- 打开全新的PowerShell窗口,输入
python --version,确认输出Python 3.8.x版本号;若不生效,尝试py -3.8 --version。
第四步:重新安装Poetry
- 在PowerShell中执行安装命令:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
- 安装完成后,按照提示将Poetry的脚本路径(通常是
C:\Users\[你的用户名]\AppData\Roaming\Python\Scripts)添加到系统环境变量,重启PowerShell生效。
额外排查点
- 检查PowerShell执行策略:输入
Get-ExecutionPolicy,若显示Restricted,执行Set-ExecutionPolicy RemoteSigned并按Y确认。 - 暂时关闭杀毒软件,避免拦截安装脚本运行。
内容的提问来源于stack exchange,提问作者Dallas Caley
相关产品推荐
相关产品推荐

