[Reprint] Create an isolated python environment with virtualenv under Ubuntu

Source: Internet
Author: User
Tags install django pip install django virtual environment virtualenv

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.