Set up a virtual env in python
In VSCode, runpython -m venv < YOUR-PATH > \venv
For example:
python -m venv F:\Project\venv
In the Command Palette, search for 'Python Select Interpreter'. Then select 'Python: Select Interpreter'.
Select your Python Interpreter. Select the one within the virtual environment i.e. \venv\Scripts\python.exe.
Open a new terminal. This will start in a virtual environment (venv) at the start.
If the virtual environment does not start automatically, run
venv\Scripts\activate
If getting an error, run
Get-ExecutionPolicy
If it shows 'Restricted', change it to 'Unrestricted' using the below command.
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
TIP: If you want to select a specific version of python when creating the virtual environment, start the venv command with that version. You obviously need to have that version installed and the python program in bin added to the PATH.
python3.6 -m venv "my_env_name"