Id : CommandNotFoundException

2025年10月08日 15:47 响应: 3.39秒 状态: success

🚨 错误信息

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

🤖 AI解决方案

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 LANGCHAIN_TRACING_V2="true"
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (export:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

原因分析

在Windows PowerShell环境中,export 命令不是一个内置的 cmdlet,用于设置环境变量的标准方式是使用 $env: 前缀。

解决方案

使用 $env: 来设置环境变量:

$env:LANGCHAIN_TRACING_V2="true"

预防措施

  • 熟悉Shell语法:了解你正在使用的Shell(如PowerShell、Bash、Zsh)的环境变量设置语法。
  • 查阅文档:在不确定的命令或语法时,查阅相关Shell或工具的官方文档。