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

評価なし
バージョン履歴
最終更新日:
木曜日
更新者: