13. creating a virtual env
virtualenv [options] <dest_dir>
Create a new virtual environment at the specified
path. It will contain a copy of all system-wide
packages.
!
Useful options
—-no-site-packages
Create a new empty virtual environment.
—-python=<python path>
Use the specified Python executable.
14. switching to a virtual env
> source <dir>/bin/activate
(v1)>
!
!
Exiting current virtualenv
(v1)> deactivate
>
15. cool stuff with pip +
virtualenv
!
pip freeze > requirements.txt
Create a description file with the packages and
versions installed under the current virtualenv.
!
pip install -r requirements.txt
Install all packages according to the specification
in requirements.txt.
16. summary
• Packages: code someone else has written
(SciPy, Django, lxml, pymongo)
• Find packages on PyPI: pypi.python.org
• Install them using pip
• Keep your environment clean by using
virtualenv