first, the installation of Virtualenv
1. Using PIP to install virtualenv globally, it is recommended to use PIP 1.3 or later, before 1.3, Pip is not downloaded from PyPI via SSL.
$ [sudo] pip install virtualenv
Or the latest unreleased version: (GitHub address may change)
$ [sudo] pip install Https://github.com/pypa/virtualenv/tarball/develop
Other download installation method is not recommended, because the address will change, trouble ... I want to see it.
second, the use of virtualenv
1. Create a virtual environment
Use the following command to create a directory for a virtual environment
$ virtualenv ENV
The following directories are typically found in the generated virtual environment directory:
Lib and include: contains the new virtualenv Python support library file, and the packages installed in the virtual environment will be placed in the lib/pythonx.x/site-packages/.
Bin: The directory has a number of executables, such as Python, running the Bin/python run script that can be executed in that environment. The PIP in this directory also has a similar effect.
2. Activating and deactivating the environment
$ source Bin/activate # Bin/activate applies to Bash/zsh/dash.
This command will change your $path so that the first entry for your $path is the bin/directory of the current virtual environment, and the script will also modify your shell prompt.
When creating a virtual environment, the packages that need to be used to the global can be inherited /usr/lib/python2.7/site-packages(not rigorous here) by using the following:
$ virtualenv--system-site-packages ENV
To undo these actions as you want to run:
$ deactivate
Windows here do not do too much to explain, similar, interested can point here
Python virtualenv Use summary article