Django – How to Clone a Virtual Environment

clone virtual environment django

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.

clone virtual environment django

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.


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:

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

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:


Hope this helps.
Good Luck,