Vs code: Difference between revisions

From wikiluntti
 
(2 intermediate revisions by the same user not shown)
Line 12: Line 12:
</code>
</code>


The '''virtual environment''' can be created and activated from the status bar (lower right corner), or by using  
The '''virtual environment''' can be created and activated from the status bar (lower right corner), and the status bar reads ''venv''.  Also by using  
<code>
<code>
C:\Users\user\AppData\Local\Programs\Python\Python313\python.exe  -m venv .venv  
C:\Users\user\AppData\Local\Programs\Python\Python313\python.exe  -m venv .venv  
Line 22: Line 22:
Now the python command works without using the path. Installing packages works:  
Now the python command works without using the path. Installing packages works:  
<code>pip install opencv-python</code>
<code>pip install opencv-python</code>
Install packages
<code>
C:\Users\user\AppData\Local\Programs\Python\Python313\python.exe -m pip install --upgrade pip
</code>
<code>
pip install opencv2-python
</code>

Latest revision as of 13:46, 15 May 2026

Introduction

Python and virtual environment

  1. Open a Python file
  2. Check the Status Bar to see which environment is active
  3. To switch environments, select the environment control in the Status Bar


Find the Python folder by clicking the run button and by checking the terminal. Python works on C:\Users\user\AppData\Local\Programs\Python\Python313\python.exe

The virtual environment can be created and activated from the status bar (lower right corner), and the status bar reads venv. Also by using C:\Users\user\AppData\Local\Programs\Python\Python313\python.exe -m venv .venv and activate it by using .venv\Scripts\activate Now the python command works without using the path. Installing packages works: pip install opencv-python