PyCharm can use the functions in virtualenv to create virtual environments. PyCharm is tightly integrated with virtualenv, so you only need to configure it in the setting to create a virtual environment. And PyCharm bundles virtualenv, we don't need to install it separately. The general creation process is as follows:
1. Open the Project Interpreters page: File -> Settings - > Project - > Project Interpreters;
2. Select the project , click the configuration button on the right and select Create VirtualEnv. At this time, the Create Virtual Environment dialog box will pop up;
3. Configure the new environment:
Fill in the name of the new virtual environment in Name, or use the default name to facilitate future installation of third-party packages and other projects;
In Location Fill in the file directory of the new environment;
Select the Python interpreter in the Base interpreter drop-down box;
Check Inherit global site-packages to use third-party libraries in the base interpreter. If not, it will be completely isolated from the outside world;
Check Make available to all projects to make this virtual environment available to other projects.
4. Click OK and everything is configured. Isn't this much simpler than configuring virtualenv separately?