Build a Django Project virtual environment (under Windows System)

Source: Internet
Author: User
Tags virtual environment virtualenv

First, install the virtualenv

We can install it using the PIP in a formal Python environment. Enter the cmd interface, run "Pip install Virtualenv", after the installation is complete, you can run "where virtualenv" to verify the installation situation.

Second, the establishment of virtual environment

In order to facilitate management, we have to create a directory, unified to place all the virtual environment.

Run the command "Virtualenv-p c:\...\python36\pythonw.exe--no-site-packages D:\Python_virtualenvs\for_django", where

-P: Used to specify the Python version to be virtual, where the local Python3.6 version is selected

--no-site-packages: Indicates that the third-party library in the original version will not be copied when the virtual environment is established, so that a pure Python environment can be obtained.

D:\Python_virtualenvs\for_django: Indicates that a virtual environment called For_django is established under this directory.

  

Third, the use of virtual environment

Under the cmd command line, go to the Scripts folder under the virtual environment directory that you want to use, and run the "activate" command into the current virtual environment. Now it can be used as a normal python environment.

  

where (For_django) means that it is currently in this virtual environment, and then can be arbitrarily manipulated, this is entered into the virtual environment in the MySite project.

When you exit the virtual environment, just run the "decativate" command in the scripts directory. If you want to delete a virtual environment, delete the folder where the virtual environment is located directly, but make sure that the virtual environment is no longer necessary to delete it, or it will affect all projects related to that virtual environment.

 

Build a Django Project virtual environment (under Windows System)

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.