Django – How to Clone a Virtual Environment

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.

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:

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,
Serdar

Serdar Osman Onur
I love coding web stuff, learning/applying new technologies and techniques to create things on the internet since 2004. AboutMe G+ twitter
Serdar Osman Onur

@serdarosmanonur

hard work, determination, dedication, patience, consistency, faith
"We forge our bodies in the fire of our will" - Enter the Dragon - 1973 - 4 days ago
Serdar Osman Onur