This article was reproduced from: http://www.xuzefeng.com/post/89.html
Today finally sunny, in a good mood. Some notes about virtualenv are being sorted out today. Virtualenv is a tool to create isolated Python environments. For "isolated python environments", people on the Internet because of the word virtual Python environment, some people directly known as the isolated Python environment, all represent the same meaning.
Virtualenv creates a separate Python run environment, isolates dependencies between different projects on the same LIB, and installs new package on some directories/machines without permission issues.
Reasons to use Virtualenv:
1. Third-party package dependencies between quarantined items, such as a project dependent on the DJANGO1.2.5,B project relies on django1.3.
2, for the deployment of applications to provide convenience, the development environment of the virtual environment package to the production environment, do not need to toss on the server.
Brief steps
1. Install Pip
$ sudo apt-get install Python-pip
2, Installation Virtualenv
$ sudo pip install virtualenv
3. Create an isolated environment
$ virtualenv Test
4. Activating the isolated environment
$ source Test/bin/activate
5, we can see that the command line has been added (test), this time we look at the path that Python points to:
$ which Python
6, install django1.5.1, do not add sudo
$ pip Install django==1.5.1
7, run Python, type import django, enter, no error is installed.
Add
To exit the virtual environment
$ deactivate
To uninstall PIP
$ sudo apt-get remove Python-pip
To uninstall Virtualenv
$ sudo pip uninstall virtualenv
Document
$ virtualenv--help
Original document
Chinese version of document
[Reprint] Create an isolated python environment with virtualenv under Ubuntu