Python virtualenv or venv are the short forms of virtual environment.
Virtualenv is useful for different projects with unique requirements for each of them, like versions of python or at least different versions of Python libraries.
So they run parallel on a same system in separated from each other environments without any conflicts between them.
Some straight forward examples on macOS:
pip3 install virtualenv
To make a virtual environment:
virtualenv venv
# make a virtual environment with special python version
virtualenv -p /usr/bin/python2.7 venv
Activate the created virtual environment:
source venv/bin/activate
Freeze environment packages:
pip freeze –local > requirements.txt
Install early freezed packages:
pip install -r requirements.txt
To get out of your virtual environment, simple type:
deactivate
[…] Virtualenv was for me until 2020 a python-default tool for creating isolated virtual environments for python projects.Virtualenv was always easy to handle and known as a mature pythonic tool under python developers. But now, its time to switch to pipenv :) […]