Id : CommandNotFoundException
🚨 错误信息
export : 无法将“export”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写
,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ export OPENAI_API_KEY="https://api.chatkore.com"
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (export:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
🤖 AI解决方案
powershell
export : The term 'export' 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
+ export OPENAI_API_KEY="https://api.chatkore.com"
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (export:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
原因分析
在 Windows PowerShell 中,export 不是一个内置命令。你可能是在 Linux/macOS 环境中使用 export 命令来设置环境变量,但在 PowerShell 中,设置环境变量的语法是不同的。
解决方案
在 PowerShell 中,使用 $env: 前缀来设置环境变量。
powershell
$env:OPENAI_API_KEY = "https://api.chatkore.com"