PlatformIO Community

Python version - Zephyr-blink example gives compilation error in the PIO terminal

I am trying to run the Zephyr-blink using PIO and VSCode in Windows 10. Got the below error saying Python3.4 or higher is required.

Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 5.7.0 #83ca86b > ST Nucleo L073RZ
HARDWARE: STM32L073RZ 32MHz, 20KB RAM, 192KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1), framework-zephyr-hal-stm32 0.0.190619, tool-cmake 3.15.5, tool-dtc 1.4.7, tool-ninja 1.9.0, framework-zephyr 1.20000.191203 (2.0.0)
Python 3.4 or greater required, but you have Python 2.7.14

Initially, when I checked the python version in the PIO terminal it was 2.7. Then tried to make Python 3.7 as the default python in the Windows system environment variables. After that in the PIO terminal, it gave me the new python version as below.

PS C:\Official_Scene\SW\platform-ststm32\examples\zephyr-blink> python --version 
Python 3.7.4

However, while compiling the code it shows the same error again. I was wondering why not PlatformIO consider the updated Python version during compilation.

Updated: Removed all the python versions from my laptop, still it gives me the below error:
“Python 3.4 or greater required, but you have Python 2.7.17”

Can anyone help please?

@ivankravets Regarding this error, how can the python version being used by the VSCode PIO plugin be changed or selected?

1 Like

I need to know this too.

My SCons scripts use Python 3, but Python 2.7 is used to run SCons. Checking the pio terminal I see that Python 2.7 has been automatically installed in .platformio/penv.

The code is now compiling after manually deleting the python.exe from the folder “C:\Users\xxx.platformio\penv”. I think it’s now detecting the default python set by the system environment path.
I dont think this is a proper fix though.

1 Like