How to duplicate virtualenv
--
Track title: CC L Beethoven - Piano Sonata No 8 in C
--
Chapters
00:00 Question
00:29 Accepted answer (Score 235)
01:44 Answer 2 (Score 38)
01:59 Answer 3 (Score 18)
02:14 Answer 4 (Score 15)
03:01 Thank you
--
Full question
https://stackoverflow.com/questions/7438...
Answer 1 links:
[virtualenv-clone]: https://github.com/edwardgeorge/virtuale...
Answer 2 links:
[command to duplicate virtualenv]: https://virtualenvwrapper.readthedocs.io...
Answer 3 links:
[virtualenv-clone]: https://pypi.org/project/virtualenv-clon.../
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #virtualenv
#avk47
ACCEPTED ANSWER
Score 249
The easiest way is to use pip to generate a requirements file. A requirements file is basically a file that contains a list of all the python packages you want to install (or have already installed in case of file generated by pip), and what versions they're at.
To generate a requirements file, go into your original virtualenv, and run:
pip freeze > requirements.txt
This will generate the requirements.txt file for you. If you open that file up in your favorite text editor, you'll see something like:
Django==1.3
Fabric==1.0.1
etc...
Now, edit the line that says Django==x.x to say Django==1.3 (or whatever version you want to install in your new virtualenv).
Lastly, activate your new virtualenv, and run:
pip install -r requirements.txt
And pip will automatically download and install all the python modules listed in your requirements.txt file, at whatever versions you specified!
ANSWER 2
Score 39
Another option is to use virtualenv-clone package:
A script for cloning a non-relocatable virtualenv.
ANSWER 3
Score 18
virtualenvwrapper provides a command to duplicate virtualenv
cpvirtualenv ENVNAME [TARGETENVNAME]
ANSWER 4
Score 12
If you are using Anaconda you can just run:
conda create --name myclone --clone myenv
This will copy myenv to the newly created environment called myclone.