Contents
Description
Virtualenv is a tool for creating isolated virtual python environments. It is recommended to install PyPI packages within virtual environments, instead of system wide, to prevent version collisions when developing and running python projects.
Virtualenv creates for each new environment a directory containing its own Python, pip, and wheel instances. It also contains any installed packages. These environment directories are not meant to be put inside of a project, nor should the project be created within the environment directory. Instead it is advisable to choose a dedicated location to put all your virtual environments, separate from your source code.
Snippets
Creating a virtualenv
Activating a virtualenv
1 $ source virtualenv/bin/activate
Deactivating a virtualenv
1 $ deactivate
Exporting (virtualenv) packages
1 $ pip freeze > requirements.txt
Importing (virtualenv) packages
1 $ pip install -r requirements.txt