Python 3.4 supports native virtual environment configurations (3.3 of virtual environments do not support PIP), and the configuration process is recorded as a memo.
1. Create a virtual environment
In the console, use the CD directory to switch to the directory where you want to create the virtual environment.
Use the following command to create a virtual environment in the current directory.
Python-m venv <name>
Such as
Python-m venv venv
After the successful creation, in the directory, there are the following files:
Windows:
2. Activating the virtual environment
Switch to the directory where the virtual environment was created successfully, and execute the following command to activate the virtual environment
Windows:
Scripts\activate.bat
After the activation succeeds, the name of the virtual environment is displayed in the console.
3. Installing packages in a virtual environment
In case of successful activation of the virtual environment, install the package online using the following command
Install <package>
For example, installing Pika
Install Pika
For downloads to a local installation package, also in the case of activating the virtual environment, use the CD command to switch to the directory where the package is located, using a command similar to the following to install
Install
After the installation is successful, use the PIP List command to view the installed packages
PIP List
4.Pycharm Switch to Virtual environment
In the location, switch to the virtual environment directory.
python3.x Configuring a native virtual environment