Python Virtual Environment

Source: Internet
Author: User
Tags virtual environment virtualenv

1. Install the virtual environment

$ sudo easy_install virtualenv

2. Create a virtual environment

$ virtualenv "env_name】   
For example:
$ virtualenv Virtualtest

Where--no-site-packages can be used to indicates that the virtual environment does not access the global site-packages. So we can isolate a clean test environment even in systems where we have a large number of development packages installed. can be through check Sys.path or "lib/python2.6/no-global-site-packages.txt" file to determine whether to access Global Site-packages .

$ virtualenv--no-site-packages "env_name】
例如:
$ virtualenv --no-site-packages virtualtest

3. Activating the virtual environment

$ source Virtualtest/bin/activate

4. Verifying the libraries used by the virtual environment

(virtualtest) **:~$ which Python (virtualtest)which Easy_install

5. Quit activating the virtual environment

(virtualtest)**:~$ Deactivate

6. Installing a third-party library in a virtual environment

Pip Install *                (here * denotes third-party software library name) *

Related Article

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.