The MCUXpresso Installer starting with v1.3 and the MCUXpresso extension for VS Code use a virtual environment (VE) for Python. To manually use this VE from CLI, install new modules or upgrade modules, this VE needs to be activated.
You can activate the VE and use CLI within VS Code. In the MCUXpresso view, right-click a project and select "Open in Integrated Terminal".
The Terminal view opens, the VE is activated, and the path is set to the project folder location. For more details, see this wiki.
The VE is activated by running a script, in Windows the script is a activate.bat file. The MCUXpresso Installer log shows the path to this script. In Windows, this script is typically installed at C:\Users\<username>\.mcuxpressotools\.venv\Scripts\activate.bat. Running this script from a command window activates that environment. In the screenshot below, notice the prompt includes the (.venv) VE name after the script runs.
Now Python commands can be run within this VE. If multiple Python versions are installed in the system, you can ensure the VE Python is used by using the full path to the VE Python executable. For example, to install pip in this VE in Windows, run this command:
C:\Users\<username>\.mcuxpressotools\.venv\Scripts\python.exe -m ensurepip --upgrade
Return to Zephyr Knowledge Hub