I wanted to write 1 more post in 2016 before the year ends. So, here it is 🙂 Let’s talk a little more about Virtual Environments.

If you have a virtual environment you can back it up and re-create it later with the exact same installations in it. No need to worry about what and which versions were installed.

Actually, what we will do is not cloning the Virtual Environment, it is just exporting the configuration of it (as I said this includes the installation and version info) which can be used later in a brand new Virtual Environment to make it an exact same copy of this exported one.

FREEZING & INSTALLING

This export of installation configurations is called “freezing”. Below is how you can do it in console.

First activate your virtual environment. Then type below:

1

$pip freeze>Desktop/requirements.txt

Above line will create a text file whose content will be something like this:

1

2

3

4

5

Django==1.9.7

django-mptt==0.8.7

django-simple-captcha==0.5.2

Pillow==3.3.1

six==1.10.0

If in the future you want to re-create this Virtual Environment all you need to do is open a console, activate your newly created Virtual Environment and type the below line: