Creating "virtualenv" for an existing project
The key thing is creating requirements.txt
.
Create a virtualenv as normal. Do not activate it yet.
Now you need to install the required packages. If you do not readily remember it, ask pip
:
pip freeze > requirements.txt
Now edit requirements.txt
so that only the packages you know you installed are included. Note that the list will include all dependencies for all installed packages. Remove them, unless you want to explicitly pin their versions, and know what you're doing.
Now activate the virtualenv (the normal source path/to/virtualenv/bin/activate
).
Install the dependencies you've collected:
pip install -r requirements.txt
The dependencies will be installed into your virtualenv.
The same way you'll be able to re-create the same env on your deployment target.
You can just create an virtual enviroment with virtualenv venv
and start it with venv/bin/activate
.
You will need to reinstall all dependencies using pip, but the rest should just work fine.