Python Virtual Environment used by VS Code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python Virtual Environment used by VS Code

Python Virtual Environment used by VS Code

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.

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. 

dereksnell_0-1717621214329.png

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

 

No ratings
Version history
Last update:
3 weeks ago
Updated by: