小智AI烧录/ESP32切换目标板报错的处理 Failed to set target esp32s3:non zero exit code 2

小智AI烧录/ESP32切换目标板报错的处理 Failed to set target esp32s3:non zero exit code 2

这一篇解决这个报错,这是在烧录esp32s3等系列芯片常发生的问题,具体表现是报以上的错,或者删除build后成功切换到esp32s3了,但是此时又打不开齿轮的config界面了。

配置

原码版本是1.8.3,不建议用最新的原码,然后ESP-IDF的版本是5.5.1,串口选UART,自行选择端口COMX,初始时目标板是型号是esp32,上图是解决后的截图。

下载ESP-IDF5.5.1(完成可跳过)

先打开ESP-IDF,如果在左侧栏没找到就点击三个点。

然后点开“Advanced”,点击配置扩展

等待一会,出现这个页面选择ADVANCED

在version项选择5.5.1

然后选择安装路径(大约1.8G),点击configureTools即可,要等待很久,然后会有一个下载tools的界面,正常下载即可。

注意,在下载期间不要切换网络,断了就白下了,需要删除文件夹重新下。

解决

# 1. 打开 ESP-IDF PowerShell(不是普通PowerShell!)

ctrl+shift+P,输入ESP-IDF:Open ESP-IDF Terminal打开终端

conda deactivate 直到完全退出虚拟环境(PS前面不带括号为止,每个人的初始配置可能不一样)

(mindspore_env) PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> conda deactivate (base) PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> conda deactivate PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> 

echo $env:IDF_TARGET   会输出esp32,此时不是s3

PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> echo $env:IDF_TARGET esp32

 $env:IDF_TARGET = "esp32s3"   切换为s3

echo $env:IDF_TARGET     检查环境变量是否切换成功

PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> $env:IDF_TARGET = "esp32s3" PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> echo $env:IDF_TARGET esp32s3

'c:\Users\HP\.vscode\extensions\espressif.esp-idf-extension-1.10.2\export.ps1'

(在下一步前一定要删除 build sdkconfig sdkconfig.old components/ 文件)

idf.py fullclean

这是没删除时的报错:

PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> idf.py fullclean Executing action: fullclean Directory 'E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3\build' doesn't seem to be a CMake build directory. Refusing to automatically delete files in this directory. Delete the directory manually to 'clean' it.

删除后输出如下:

PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> idf.py fullclean Executing action: fullclean Build directory 'E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3\build' not found. Nothing to clean. Executing action: remove_managed_components Done

idf.py set-target esp32s3

等待执行完毕即可,此时切换到配置页面也正常了

结束。

后续操作

后续就可以更改配置文件,选择flash、psram等配置,然后点击扳手或小火苗进行编译和构建和监视了。

如图成功。

临时记录(不用看了)

(mindspore_env) PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> conda deactivate (base) PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> conda deactivate PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> echo $env:IDF_TARGET esp32 PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> $env:IDF_TARGET = "esp32s3" PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> echo $env:IDF_TARGET esp32s3 PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> 'c:\Users\HP\.vscode\extensions\espressif.esp-idf-extension-1.10.2\export.ps1' c:\Users\HP\.vscode\extensions\espressif.esp-idf-extension-1.10.2\export.ps1 PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> idf.py fullclean Executing action: fullclean Directory 'E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3\build' doesn't seem to be a CMake build directory. Refusing to automatically delete files in this directory. Delete the directory manually to 'clean' it. PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> idf.py fullclean Executing action: fullclean Build directory 'E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3\build' not found. Nothing to clean. Executing action: remove_managed_components Done PS E:\Passport\xiaozhi-esp32-1.8.3\xiaozhi-esp32-1.8.3> idf.py set-target esp32s3
安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows 加载个人及系统配置文件用了 5244 毫秒。 (base) PS E:\xiaozhi-esp32> & 'c:\Users\HP\.vscode\extensions\espressif.esp-idf-extension-1.10.2\export.ps1' (base) PS E:\xiaozhi-esp32> C:/Users/HP/miniconda3/Scripts/activate (base) PS E:\xiaozhi-esp32> conda activate mindspore_env (mindspore_env) PS E:\xiaozhi-esp32> idf.py fullclean No module named 'esp_idf_monitor' This usually means that "idf.py" was not spawned within an ESP-IDF shell environment or the python virtual environment used by "idf.py" is corrupted. Please use idf.py only in an ESP-IDF shell environment. If problem persists, please try to install ESP-IDF tools again as described in the Get Started guide. (mindspore_env) PS E:\xiaozhi-esp32> conda deactivate (base) PS E:\xiaozhi-esp32> conda deactivate PS E:\xiaozhi-esp32> & 'c:\Users\HP\.vscode\extensions\espressif.esp-idf-extension-1.10.2\export.ps1' PS E:\xiaozhi-esp32> idf.py fullclean Executing action: fullclean Build directory 'E:\xiaozhi-esp32\build' not found. Nothing to clean. Executing action: remove_managed_components Aborted! PS E:\xiaozhi-esp32> idf.py set-target esp32s3 Adding "set-target"'s dependency "fullclean" to list of commands with default set of options. Executing action: fullclean Build directory 'E:\xiaozhi-esp32\build' not found. Nothing to clean. Executing action: set-target Set Target to: esp32s3, new sdkconfig will be created. Target 'esp32s3' specified on command line is not consistent with target 'esp32' in the environment. PS E:\xiaozhi-esp32> idf.py set-target esp32s3 Adding "set-target"'s dependency "fullclean" to list of commands with default set of options. Executing action: fullclean Build directory 'E:\xiaozhi-esp32\build' not found. Nothing to clean. Executing action: set-target Set Target to: esp32s3, new sdkconfig will be created. Target 'esp32s3' specified on command line is not consistent with target 'esp32' in the environment. PS E:\xiaozhi-esp32> echo $env:IDF_TARGET esp32 PS E:\xiaozhi-esp32> $env:IDF_TARGET = "esp32s3" PS E:\xiaozhi-esp32> echo $env:IDF_TARGET esp32s3 PS E:\xiaozhi-esp32> idf.py set-target esp32s3 Adding "set-target"'s dependency "fullclean" to list of commands with default set of options. Executing action: fullclean Build directory 'E:\xiaozhi-esp32\build' is empty. Nothing to clean. Executing action: set-target Set Target to: esp32s3, new sdkconfig will be created. Running cmake in directory E:\xiaozhi-esp32\build Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=E:\Passport\esp32\.espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe -DESP_PLATFORM=1 -DIDF_TARGET=esp32s3 -DCCACHE_ENABLE=1 E:\xiaozhi-esp32"...

Read more

【Python】6 种方法轻松将 Python 脚本打包成 EXE 应用

引言 Python 凭借其简洁的语法和强大的功能,在数据分析、Web 开发、自动化脚本等领域广受欢迎。它“开箱即用”的特性让开发者能够快速构建原型和应用程序。然而,对于最终用户而言,运行 Python 脚本往往意味着需要预先安装 Python 解释器及相关依赖库,这对非技术背景的用户来说无疑增加了门槛。 为了解决这一问题,将 Python 代码打包成独立的可执行文件(通常在 Windows 上是 .exe 文件)成为了一个非常实用的选择。这样,用户无需任何额外环境配置,就能像运行普通软件一样直接启动您的 Python 应用。本文将为您介绍六种主流且有效的 Python 打包工具,助您轻松实现跨平台分发。 1. PyInstaller: 最流行的选择 PyInstaller 是目前最广为人知、社区支持最广泛的 Python 打包工具之一。它能够很好地处理各种复杂的依赖关系,并支持将整个应用及其所需资源打包成一个或多个独立的可执行文件。 * 特点: * 支持 Windows,

By Ne0inhk

8 个 Python 自动化脚本让你告别重复劳动

AI的发展越来越厉害,所以很多人也习惯把任务直接丢给AI。但 AI 在处理自动化任务时有时候还会不稳定,有些还要收费。对于需要每天定时运行、处理大量文件或监控系统状态的任务,依靠 AI 每次生成结果容易出现幻觉偏差。 AI很好,但其实有时候杀鸡没必要用牛刀。Python 一样可以完成一些简单的自动化任务。 在写 Python 之前,要确保 Python 的环境已经准备好。 推荐使用 ServBay 来管理开发环境,它支持一键安装 Python 环境,覆盖了从半只脚踏进棺材板的 Python 2.7 到Python 3.5 乃至最新的 Python 3.14 版本。而且这些版本可以同时并存,不需要手动去配置环境变量,也不用担心弄乱系统的默认配置。装好就能用,一分钟就能搞定。 有了稳定的环境,下面分享几个在实际工作中常用的自动化脚本模式。 自动重试机制:让网络请求更健壮 写爬虫或调用 API

By Ne0inhk
基于Python的全国新能源汽车销量预测分析及可视化

基于Python的全国新能源汽车销量预测分析及可视化

摘  要 随着全球能源转型和环境保护意识的增强,新能源汽车已成为汽车产业发展的重要方向。我国新能源汽车产业经过多年的政策扶持和市场培育,已进入快速发展期,产销量连续多年位居全球第一。准确预测新能源汽车销量,对于政府制定产业政策、企业规划产能、投资者进行决策都具有重要意义。然而,新能源汽车销量受多种因素影响,包括政策补贴、技术进步、市场竞争、消费者偏好等,预测难度较大。 本文基于Python技术栈,设计并实现了一套全国新能源汽车销量预测分析及可视化系统。系统采用Flask框架构建Web应用,使用Pandas和NumPy进行数据处理与分析,利用Matplotlib和ECharts实现数据可视化,通过时间序列分析和机器学习方法构建销量预测模型。系统主要功能包括:销量数据采集与清洗、历史销量趋势分析、区域销量差异分析、品牌市场份额分析、多因素相关性分析以及销量预测等。 在数据采集方面,系统整合了中国汽车工业协会、乘用车市场信息联席会等权威机构发布的销量数据,以及各车企公开的销量报表。数据清洗阶段对缺失值、异常值进行处理,确保数据质量。在数据分析方面,运用描述性统计分析方法,从时间维度、区

By Ne0inhk
博主亲测!Python+IPIDEA 自动化高效采集音乐数据

博主亲测!Python+IPIDEA 自动化高效采集音乐数据

文章目录 * 一、前言 * 二、全面认识 * 2.1 初步认识 * 2.2 实际使用感受 * 三、手把手教你:从0到1的完整流程 * 四、实战体验 * 五、超多场景预设,助力解决难题 * 六、用后感受 一、前言 最近想做个某云音乐每日推荐歌单存档小工具 —— 每天自动获取推荐歌曲,存成 Excel 方便回顾。结果刚跑了 3 天,代码就报网络异常,手动访问发现被平台限制了:刷新 10 次有 8 次跳验证,根本拿不到数据。 我一开始没当回事,试了两种办法:先是用免费代理池,结果要么失效快,要么访问速度比蜗牛还慢,歌单同步成功率不到 30%;后来手动换手机热点,每天要切 3 次

By Ne0inhk