Ubuntu24.04下VSCode+PlatformIO开发microbit遇distutils缺失错误
解决Ubuntu 24.04下PlatformIO+Zephyr运行micro:bit Blink示例的distutils缺失问题
在全新Ubuntu 24.04系统中,使用VSCode搭配PlatformIO和Zephyr框架运行BBC micro:bit控制器的Blink示例时出现报错,经排查是Python 3.12环境缺少必需的distutils组件,具体报错输出如下:
... PACKAGES: - framework-zephyr @ 2.20701.220422 (2.7.1) - tool-cmake @ 3.21.3 - tool-dtc @ 1.4.7 - tool-gperf @ 3.0.4 - tool-ninja @ 1.7.1 - tool-sreccat @ 1.164.0 (1.64) - toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1) Reading CMake configuration... Parsing system calls... Generating syscall files Generating KObject files... Traceback (most recent call last): File "/home/markus/.platformio/packages/framework-zephyr/scripts/gen_kobject_list.py", line 60, in <module> from distutils.version import LooseVersion ModuleNotFoundError: No module named 'distutils' *** Error 1 Validating driver... Traceback (most recent call last): File "/home/markus/.platformio/packages/framework-zephyr/scripts/gen_kobject_list.py", line 60, in <module> from distutils.version import LooseVersion ModuleNotFoundError: No module named 'distutils' *** Error 1 ...
解决步骤
- 打开终端,执行以下命令安装Python 3的distutils组件:
sudo apt-get install python3-distutils - 安装完成后,回到VSCode重新运行PlatformIO的构建流程即可正常编译。
内容的提问来源于stack exchange,提问作者Max
相关产品推荐
相关产品推荐

