A Guide to Python’s Virtual Environments
Well, a virtual environment is just a directory with three important components:
A site-packages/ folder where third party libraries are installed.
Symlinks to Python executables installed on your system.
Scripts that ensure executed Python code uses the Python interpreter and site packages installed inside the given virtual environment.
(venv) % pip freeze numpy==1.15.3
And write the output to a file, which we’ll call requirements.txt.
(venv) % pip freeze > requirements.txt
Duplicating Environments
Sara% cd test-project/ Sara% python3 -m venv venv/ (venv) Sara% pip install -r requirements.txtCollecting numpy==1.15.3 (from -r i (line 1)) Installing collected packages: numpy Successfully installed numpy-1.15.3