Python Virtual Environment used by VS Code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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.

Using VE with the MCUXpresso extension for VS Code

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".

dereksnell_0-1763066772393.png

 

The Terminal view opens, the VE is activated, and the path is set to the project folder location.  For more details, see this wiki.

venv_activated.png

Activating VE from command line

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

Return to Zephyr Knowledge Hub

无评分
版本历史
最后更新:
‎11-13-2025 01:55 PM
更新人: