当前位置:网站首页>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脚本即可。
边栏推荐
- Web3 Games: current situation and future
- Spark scheduling analysis
- What are the contents of Oracle OCP and MySQL OCP certification exams?
- 23.9 application exit application exit
- Oracle 19C OCP 1z0-082 certification examination question bank (7-12)
- TypeScript版Snowflake主键生成器
- P3743 kotori的设备
- [GUI] GUI programming; AWT package (interface properties, layout management, event monitoring)
- Xshell batch send command to multiple sessions
- sklearn 机器学习基础(线性回归、欠拟合、过拟合、岭回归、模型加载保存)
猜你喜欢

IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!

Kotlin属性与字段

How to safely delete a useless activity in Android studio

Super potential public chain dfinity -- the best time for DFI developers to enter

基于C语言设计的换乘指南打印系统
![[C language] programmer's basic skill method -](/img/0e/e9111d4b341cc42aa4382b5fbd0001.png)
[C language] programmer's basic skill method - "creation and destruction of function stack frames"

六、品达通用权限系统__pd-tools-log

【C语言】程序员筑基功法——《函数栈帧的创建与销毁》

基于C语言的哈夫曼转化软件

Human computer interaction software based on C language
随机推荐
QT note 2
P1825 [USACO11OPEN]Corn Maze S
Kotlin function
Cadence (x) wiring skills and precautions
The second lesson is the construction of development environment
After MySQL 8 OCP (1z0-908), hand in your homework
Using the primitive root of module m to judge and solve
有限元学习知识点备案
Huffman transformation software based on C language
2022 national vocational college skills competition "network security" competition question file upload penetration test answer flag
Alphabetic string
23.5 event listeners of application events and listeners
Pxe原理和概念
Arbitrum launched the anytrust chain to meet the diverse needs of ecological projects
Status management bloc provider geTx
[untitled]
When developing flutter, idea_ ID cannot solve the problem
Super potential public chain dfinity -- the best time for DFI developers to enter
Human computer interaction software based on C language
Kotlin operator