Before entering a specific lab folder:
- install the Python
venvvirtual environment (one line) - activate the Python
venvvirtual environment (one line) - install common dependencies (one line)
cdinto a lab folder and start coding!
python -m venv .venv ; source .venv/bin/activate ; pip install -r requirements.txt
After you run python -m venv .venv (see instructions below) VS Code may pop up the following, to which we recommend you answer Yes.
For the curious, you can view the effects of this choice (or change or fix it) from the following:
Command Palette → "Python: Select Interpreter"
You can then adjust as needed, or just observe an cancel with ESC key.
# from .../labs/python, create the virtual environment
python -m venv .venv
# next activate the environment
.venv\Scripts\activate
# command prompt shows (.venv) before the folder path
# now install all dependencies
pip install -r requirements.txt
```console
## Windows (PowerShell)
```PowerShell
# from .../labs/python, create the virtual environment
python -m venv .venv
# next activate the environment
.venv\Scripts\Activate.ps1
# command prompt shows (.venv) before the folder path
# now install all dependencies
pip install -r requirements.txtIf you get an error about execution policies, consider this:
CopySet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser# from .../labs/python, create the virtual environment
python -m venv .venv
# next activate the environment
source .venv/bin/activate
# command prompt shows (.venv) before the folder path
# now install all dependencies
pip install -r requirements.txtcd lab0
python main.pyOnward!
# from any folder, as long as prompt is still (.venv)
deactivate