Python virtual environment introduction and installation:
why? Solve the problem of multiple versions of a framework, because python's framework update iteration is too fast, sometimes it is necessary to have multiple versions of a framework on the computer. At this time, the virtual environment can solve this problem. For
example, the falsk0.12 version is based on python2.7, and the
flask1.0 version is based on python3. The two versions are not compatible, so the boxes need to be loaded with different flask versions separately. open
Virtual environment installation:
Install a virtual environment:
pip install virtualenv
to open up a new virtual environment, create a box:
virtualenv [virtualenv-name]
Activate the virtual environment, and then operate in the virtual environment after activation:
linux:source [virtual environment directory]/bin/ Active
windows: Go directly to the directory of the virtual environment, and then execute the active
activation successfully, as shown in the following figure
Why activate a virtual environment?
Because I want to operate in the virtual environment to
exit the virtual environment:
deactivate