|Sudo (Photo credit: Scelus’ Comix)|
If you code in Python, you probably use virtualenv to maintain a clean setup and avoid problems with different versions of pythons. But sometimes, you need to replicate / export a virtualenv from a machine to another. This post will explain you exactly how to do this.
First, use the following commands on the origin machine:
pip freeze > requirements.txt
Then, copy your source code files from the virtualenv folder (called virtualenv_1) on the target machine. Do NOT copy the virtualenv files in folders such as bin, lib etc. We will eventually create these files with virtualenv on the new system:
sudo virtualenv virtualenv_1
Then install all the required packages:
sudo pip install -r requirements.txt
That’s it! If you have liked this article, please put a link to it on your Google+ / facebook profile are any other kind of web site: it will help others find it in the search engines. Thanks!