How to use virtualenv to achieve isolation of python environment?

For more Python development content, visit: "Python Flask Development Guide"

virtualenvIt can help us create a Pythonvirtual environment. The virtual environment can be independent and isolate the external pythonenvironment, so that we can use different pythondependencies for different projects, and errors caused by different versions of dependencies. This article is mainly to understand how to use the isolation of the virtualenvenvironment python.

install virtualenv

We can pipinstall it through virtualenv, the installation code is as follows:

$ pip install virtualenv

Create a virtual environment

After installation virtualenv, we can virtualenvcreate a virtual environment through the project.

$ virtualenv venv

Create a command in the root directory of the project venv, which will store all dependent pythonlibraries in the project.

Guess you like

Origin blog.csdn.net/chf1142152101/article/details/128230198
Recommended