当前位置:网站首页>Espressif 玩转 编译环境
Espressif 玩转 编译环境
2022-07-26 08:40:00 【嵌入式工程狮】
Espressif 的 ESP-IDF 最近发布了 release/v5.0,之前一直在 release/v4.3 上开发,不知不觉已经落后了 2 个版本(中间还有一个 release/4.4 版本)。遂将自己的 ESP-IDF 更新到了 release/v5.0 版本,本来以为执行 ./install.sh
脚本之后在执行 . ./export.sh
就可以完成编译环境的设置,事实证明没有什么事情是可以一帆风顺的。
本人使用的操作系统是 uBuntu,系统信息如下:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
下面列出一些在安装 ESP-IDF 的 release/v5.0 的编译环境中遇到的问题及解决办法。
python 版本过低
在 ESP-IDF 的 release/v4.3 上开发时,我使用的是 python 版本是 3.6.9。将 ESP-IDF 升级到了 release/v5.0 之后在
./install.sh
时候提示 python 版本过低,通过查看./install.sh
脚本可知,python 的版本检查脚本${IDF_PATH}/tools/python_version_checker.py
,继续分析该脚本可知现在 release/v5.0 支持的 pyhon 最小版本为 3.7 以上。解决方法很简单,升级 python 版本即可,可以借助
update-alternatives
实现多个 python 版本的管理。这是我就安装了 python 的 3.8.12 版本。#!/usr/bin/env bash set -e set -u basedir=$(dirname "$0") IDF_PATH=$(cd "${basedir}"; pwd -P) export IDF_PATH echo "Detecting the Python interpreter" . "${IDF_PATH}/tools/detect_python.sh" echo "Checking Python compatibility" "${ESP_PYTHON}" "${IDF_PATH}/tools/python_version_checker.py" TARGETS=`"${ESP_PYTHON}" "${IDF_PATH}/tools/install_util.py" extract targets "[email protected]"` echo "Installing ESP-IDF tools" "${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" install --targets=${ TARGETS} FEATURES=`"${ESP_PYTHON}" "${IDF_PATH}/tools/install_util.py" extract features "[email protected]"` echo "Installing Python environment and packages" "${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" install-python-env --features=${ FEATURES} echo "All done! You can now run:" echo "" echo " . ${basedir}/export.sh" echo ""
import sys try: # Python 2 is not supported anymore but still the old way of typing is used here in order to give a nice Python # version failure and not a typing exception. from typing import Iterable except ImportError: pass OLDEST_PYTHON_SUPPORTED = (3, 7) # keep it as tuple for comparison with sys.version_info def _ver_to_str(it): # type: (Iterable) -> str return '.'.join(str(x) for x in it) def is_supported(): # type: () -> bool return sys.version_info[:2] >= OLDEST_PYTHON_SUPPORTED[:2] def check(): # type: () -> None if not is_supported(): raise RuntimeError( 'ESP-IDF supports Python {} or newer but you are using Python {}. Please upgrade your ' 'installation as described in the documentation.'.format( _ver_to_str(OLDEST_PYTHON_SUPPORTED), _ver_to_str(sys.version_info[:3]) ) ) if __name__ == '__main__': check()
/home/esp/.espressif/python_env/idf5.0_py3.8_env/bin/python: No module named pip
出现这个问题就很奇怪了,一开始我是以为我 python 的 3.8.12 版本没有安装 pip,所以就直接通过以下命令来安装 pip:
sudo apt install python3-pip
安装完成了之后直接执行
pip --version
来确认下 pip 是否安装成功,结果如下所示:pip 22.2 from /home/esp/.local/lib/python3.8/site-packages/pip (python 3.8)
有如上所示的信息,就代表 pip 安装成功了,遂继续执行
./install.sh
脚本,结果还是报 /home/esp/.espressif/python_env/idf5.0_py3.8_env/bin/python: No module named pip 的错误,明明 pip 已经安装成功了,这里怎么还会报这个错误。进入 ESP-IDF 的 python 环境目录
~/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8
,发现在该目录下的site-packages
目录下没有pip
的目录,猜测./install.sh
脚本中其实真正想使用的是 Espressif 自定义的 python 目录,而不是在 ubuntu 上指定的 python 目录。经过以上分析,那解决方法只有一个,在 Espressif 自定义的 python 目录
~/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8
下的site-packages
中安装上 pip 即可。执行以下两条命令即可:curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
/home/esp/.espressif/python_env/idf5.0_py3.8_env/bin/python3 get-pip.py
执行完成后查询
site-packages
目录,发现该目录下已经有了pip
目录。之后再次执行./install.sh
脚本即可。
边栏推荐
- Arbitrum Nova release! Create a low-cost and high-speed dedicated chain in the game social field
- Flutter WebView jitter
- Oracle 19C OCP 1z0-082 certification examination question bank (24-29)
- Xtrabackup appears' flush no '_ WRITE_ TO_ BINLOG TABLES‘: 1205 (HY000) Lock wait timeout exceeded;
- Super potential public chain dfinity -- the best time for DFI developers to enter
- OA项目之我的会议(会议排座&送审)
- Code cloud change remote warehouse command
- 为什么要在时钟输出上预留电容的工位?
- [freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls
- 解决C#跨线程调用窗体控件的问题
猜你喜欢
uni-app 简易商城制作
Winter vacation homework & Stamp cutting
PXE principles and concepts
23.6 23.7 web environment web environment variable reading
Mysql/mariadb (Galera multi master mode) cluster construction
Kept dual machine hot standby
Spark persistence strategy_ Cache optimization
[freeswitch development practice] user defined module creation and use
QT uses QSS to make a beautiful login interface (hand-in-hand teaching)
Uninstallation of dual systems
随机推荐
基于Raft共识协议的KV数据库
Ansible important components (playbook)
Run file command
After MySQL 8 OCP (1z0-908), hand in your homework
The second lesson is the construction of development environment
Flutter compilation fails
Flutter custom player progress bar
Dear teachers, how can sqlserver get DDL in flinkcdc?
Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
[abstract base class inheritance, DOM, event - learning summary]
Alphabetic string
Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
利用模m的原根存在性判断以及求解
Logic of data warehouse zipper table
【搜索专题】看完必会的搜索问题之洪水覆盖
Kept dual machine hot standby
Does flinkcdc now support sqlserver instance name connection?
Kotlin function
【C语言】程序员筑基功法——《函数栈帧的创建与销毁》
Web3 Games: current situation and future