1 Problem description
When M projects require n versions of the Python Environment Configuration (m>n), we don't need to create a virtual environment for each project, just create n virtual environments. This reduces the amount of work (especially when m is much larger than N). But how do you create these n environments and manage those environments?
2 Problem Solving Ideas
Through the three-party package Virtualenvwrapper-win to solve. Virtualenvwrapper-win is a toolkit based on virtualenv development. It can be scattered in various paths under the virtual environment, centralized to the unified path to manage, convenient for each virtual environment switch.
3 Specific resolution steps
3.1 Installing Virtualenvwrapper-win
Open a command prompt, enter the following name to install
Pip Install Virtualenvwrapper-win
Or
python3-m pip Install Virtualenvwrapper-win
3.2 Virtualenvwrapper-win Instructions for use
3.2.1 Creating a virtual environment
(1) syntax
MKVIRTUALENV Virtual Environment Name
(2) interface effect
(3) Effect of effect
will be created in a specific folder. Under Windows, the default is in the Envs folder of the user directory
3.2.2 Activating a virtual environment
The newly created virtual environment is automatically activated when the creation is complete, or you can activate the virtual environment with the Workon command, as shown in the following code:
Workon Virtual Environment Name
Example: Workon ENV2
3.2.3 View all Virtual environments
(1) syntax
Lsvirtualenv
Or
Workon
(2) interface effect
(3) Effect of effect
List all virtual environments created in the Envs folder
3.2.4 Switching Active Virtual Environments
(1) syntax
Workon Virtual Environment Name
(2) interface effect
(3) Effect of effect
Exits the virtual environment ENV1 and activates the specified virtual environment ENV2.
3.2.4 shutting down the virtual environment
(1) syntax
Deactivate
(2) interface effect
(3) Effect of effect
Turn off the active virtual environment
3.2.5 Deleting a virtual environment
(1) syntax
RMVIRTUALENV Virtual Environment Name
(2) interface effect
The effect of the pre-deletion interface is as follows:
After deleting the interface effect is as follows:
(3) Effect of effect
Deletes the specified virtual environment, deletes the corresponding folder, and exits the activation state of the corresponding virtual environment.
More operations See official website address: Https://pypi.python.org/pypi/virtualenvwrapper-win
The Virtualenvwrapper-win of python--virtual environment