我正在尝试将 idf.py 作为 CMD 命令运行。我已经设置了我的环境变量它仍然无法识别

问题描述 投票:0回答:3

我已经设置了我的环境变量来使用 esp32 工具链。核心功能之一是 idf.py,需要从终端访问它。

如果我尝试在 VS Code 中访问它,我会得到

idf.py : The term 'idf.py' is not recognized as the name of a cmdlet, 
function, script file, oroperable 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
+ idf.py
+ ~~~~~~
+ CategoryInfo          : ObjectNotFound: (idf.py:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Here 是我的 echo %path% 的图片,您可以在其中看到我已经明确指出 idf.py.exe 是一个路径。不幸的是,我很困惑,不确定下一步是什么。

python variables cmd environment esp32
3个回答
1
投票

杀死终端并打开 ESP-IDF 终端


0
投票

有同样的问题。通过确保我的 idf.espIdfPath(转到文件,然后是首选项,然后是设置,然后搜索“idf.espIdfPath”)指向正确的环境变量(我的是从系统环境变量指向 IDF_TOOLS,但应该是而是指向 IDF_TOOLS_PATH)。修复该问题,然后通过键入“code”从 ESP-IDF 终端重新启动 vscode。从项目目录。这似乎可以解决问题。最坏的情况,我知道这不是理想的选择,也许重新安装 vscode 和所有你需要的扩展?


0
投票

问题的根源可能是您使用的是 PowerShell 而不是 Command Prompt

要从 ESP-IDF 框架构建示例,请按照以下步骤(在 命令提示符 中):

  1. 导航到 ESP-IDF 安装文件夹
    cd d:\py_esp_idf
  2. 运行
    install.bat
    (只在ESP-IDF框架安装后运行一次,不是每个例子都运行一次)
  3. 运行
    export.bat
    (这会将 idf.py 添加到您的系统环境路径中)
  4. 导航到您的示例(例如:
    cd examples/get-started/hello_world
  5. 建立你的例子(例如:
    idf.py build

查看此屏幕截图以获得完整的演示

© www.soinside.com 2019 - 2024. All rights reserved.