python3 -m venv /path/to/new/virtual/environment
NOTE:
- Changed in version 3.5: The use of
venv
is now recommended for creating virtual environments. - Deprecated since version 3.6:
pyvenv
was the recommended tool for creating virtual environments for Python 3.3 and 3.4, and is deprecated in Python 3.6.
cd /path/to/new/virtual/environment
source bin/activate
deactivate
pip3 install -r requirements.txt
pip freeze
will produce a similar list of the installed packages, but the output uses the format that pip install expects.
pip3 freeze > requirements.txt
Display all of the packages installed in the virtual environment:
pip3 list --format=columns
# or
pip3 freeze