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)