The Python virtualenv
Install VirtualEnv2.1 Install Virtualenv2.2 Create virtual Environment 2.3 Activate/exit virtual Environment
3. TIps
1. What is VirtualEnv
Virtualenv is short for Virtual Environment, meaning a virtual environment.
so what’s good about python using it?Some!
suppose I did A project A before, using Django2.2. Now that there is a new version of Django3.1, I want to use the latest version of Django. The problem is that I installed the new version of Django, and project A using the old version may not run smoothly.
this is where virtualenv comes in. It can create multiple virtual environments simultaneously, allowing multiple versions of Django to exist on a single computer.
2. Install VirtualEnv
2.1 install virtualenv
pip install virtualenv
2.2 Create a virtual environment
Create a virtual environment.
command format:
virtualenv+ environment name
virtualenv test_env1
virtualenv test_env2
2.3 Activate/exit the virtual environment
Enter the virtual environment, and then you can install the package in the virtual environment.
Win:
Run\Scripts\activate access a virtual environment
Run\Scripts\deactivate exit a virtual environment
3. TIps
There is no package installed in the virtual environment and a re-pip is required. The Python interpreter is in the /Scripts/ Python.exe directory.