Summary of a.

Usually it’s not enough to use Python’s own standard library for our projects. We also need other libraries written by others (or ourselves), also known as tripartite libraries. At the same time, we are not just a project, project dependencies between libraries may also differ, then we can make the environment isolation, is creating a virtual environment for each project, the project a run in the environment. A, b project running in the environment b, we can in the operation of the respective project environment of good projects rely on third-party libraries.

2. Speaking

1. Install it using venv, a Python built-in module

Venv will usually have the latest version of Python available to you. If you have more than one version of Python on your system, you can specify the Python version yourself. To install the virtual environment, select an installation directory

python -m venv my_first_venv

It will come with a Python interpreter

We can select the interpreter in our virtual environment (activate) in PyCharm

And we’re done

2 I can also use the VirtualEnv package to install

This requires us to use PIP to install

pip install virtualenv

After installed

virtualenv my_venv

Then you can create your virtual environment



Ditto for selection method