python:virtual_environments
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python:virtual_environments [2015/03/08 23:17] – adding common usage kauffman | python:virtual_environments [2016/06/30 11:56] (current) – [Other things you should know] kauffman | ||
---|---|---|---|
Line 4: | Line 4: | ||
A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable. For example, you can work on a project which requires Django 1.3 while also maintaining a project which requires Django 1.0. ((http:// | A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable. For example, you can work on a project which requires Django 1.3 while also maintaining a project which requires Django 1.0. ((http:// | ||
+ | ==== Other things you should know ==== | ||
+ | - https:// | ||
+ | - http:// | ||
==== Using Virtual Environments ==== | ==== Using Virtual Environments ==== | ||
The python virtual environment package is installed by default on most CS machines. To make sure you can do the following: | The python virtual environment package is installed by default on most CS machines. To make sure you can do the following: | ||
Line 91: | Line 94: | ||
(exampleproject)user@computer: | (exampleproject)user@computer: | ||
user@computer: | user@computer: | ||
- | </ | ||
- | |||
- | ====== virtualenvwrapper ====== | ||
- | virtualenvwrappers goal is to make virtualenv easier to use... sort of like when iTunes automatically organizes your iTunes library. | ||
- | |||
- | ==== Basic Usage ==== | ||
- | === Create a virtual environment === | ||
- | This creates the exampleproject folder inside ~/Envs. | ||
- | < | ||
- | user@computer: | ||
- | </ | ||
- | |||
- | === Work on a virtual environment === | ||
- | ' | ||
- | ' | ||
- | < | ||
- | user@computer: | ||
- | </ | ||
- | |||
- | Deactivating is still the same: | ||
- | < | ||
- | user@computer: | ||
- | </ | ||
- | To delete: | ||
- | < | ||
- | user@computer: | ||
- | </ | ||
- | |||
- | === Other useful commands === | ||
- | < | ||
- | lsvirtualenv | ||
- | List all of the environments. | ||
- | cdvirtualenv | ||
- | Navigate into the directory of the currently activated virtual environment, | ||
- | so you can browse its site-packages, | ||
- | cdsitepackages | ||
- | Like the above, but directly into site-packages directory. | ||
- | lssitepackages | ||
- | Shows contents of site-packages directory. | ||
</ | </ |
/var/lib/dokuwiki/data/attic/python/virtual_environments.1425874640.txt.gz · Last modified: 2015/03/08 23:17 by kauffman