?print-pdf
' Created for
Reference: pip commands
venv
module is the preferred way to create and manage virtual environments.
### make sure you are in project folder, where you want to use virtual environment
# Command Prompt:
cd
# Linux/MacOS:
pwd
### create virtual environment with name ".venv"
python -m venv .venv
.venv
is a common name for a virtual environment as it keeps the directory typically hidden in your shell.
# On Windows PowerShell run:
.venv\Scripts\Activate.ps1
# On Windows CommandPrompt run:
.venv\Scripts\activate.bat
# On Windows GitBash run:
source .venv\Scripts\activate
# On Linux, MacOS, run:
source .venv/bin/activate
Set-ExecutionPolicy Unrestricted -Scope Process
# now try again to activate:
.venv\Scripts\Activate.ps1
# On Windows, run:
where python
# On Unix or MacOS, run:
which python
# It should be in the .venv directory
deactivate
# Create virt.env - just once per project
python -m venv .venv
# Activate it - every time you will work on the project:
# On Windows CommandPrompt run:
.venv\Scripts\activate.bat
# On Linux, MacOS, run:
source .venv/bin/activate
# Install module
pip install module_name
pip freeze
pip freeze
to list all installed packages and their exact versions. Then, redirect the output to a requirements.txt file:
pip freeze > requirements.txt
pip install -r requirements.txt
# lists all installed Python versions
py -0
py -X.X -m venv myenv
myenv\Scripts\activate
These slides are based on
customised version of
framework