Python Virtual Environment virtualenv

Source: Internet
Author: User
Tags virtual environment virtualenv

virtualenv is used to create multiple standalone Python runtime environments on a single machine, which resolves:

1. Third-party package dependencies between quarantined items

2. Install a new Python package without permission

In addition, there is an additional benefit: when deploying an application, package the virtual environment of the development environment into a production environment.

1. Installation

C:\python27>pip Install Virtualenv

1. Role

D:\mysite>c:\python27\scripts\virtualenv.exe env_py27

The above code installs the ENV_PY27 environment directory in the D:\mysite directory with its file structure:

Directory of D:\mysite\env_py272018/ to/ -   .: .<DIR>          .2018/ to/ -   .: .<DIR>          ..2018/ to/ -   .: .<DIR>Include2018/ to/ -   .: .<DIR>Lib2018/ to/ -   .: .<DIR> Scripts

Where lib/site-packages contains the libraries that are installed from the system under PYTHON27. By default, the virtual environment relies on site packages in the system environment, which means that the third-party package that is already installed in the system is installed in the virtual environment, and if you do not want to rely on the package, you can add parameters- No-site-packages setting up a virtual environment

Virtualenv--no-site---no-site-packages env_py27

3. Enabling the Virtual environment

D:\mysite\env_py27>scripts\activate

4. Deactivate a virtual environment

D:\mysite\env_py27>scripts\deactivate

Python Virtual Environment virtualenv

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.