Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a virtualenv by cloning the current local environment?

Suppose I have a python interpreter with many modules installed on my local system, and it has been tuned to just work.

Now I want to create a virtualenv to freeze these, so that they won't be broke by upgrading in the future.

How can I make it? Thanks.


I can't use pip freeze, because that's a cluster on which there's no pip and I don't have the privileges to install it. And I don't want the reinstall the modules either, I'm looking for that whether there's a cloning way.

like image 914
Skyler Avatar asked Jan 06 '13 18:01

Skyler


1 Answers

Run pip freeze to create a list of all modules currently installed on the system. Then make a virtualenv and install these modules.

pip freeze > env_modules.txt
virtualenv my_env && cd my_env && source bin/activate
pip install -r ../env_modules.txt
like image 192
Jon Gauthier Avatar answered Oct 20 '22 21:10

Jon Gauthier