stay python In development , We may encounter a situation , That is, the current project depends on a certain version , But another project depends on another version , This can lead to dependency conflicts , and virtualenv
That's how it works ,virtualenv By creating a virtualized python Running environment , Install the dependencies we need , Different projects do not interfere with each other
, As shown below .
# win+r Input cmd Open console
pip install virtualenv # Installing a virtual environment
# Switch the path to the virtual environment you want to create
virtualenv Env_name # Create a name Env_name Virtual environment for (Env_name You can change it yourself )
# Switch the path to the created virtual environment folder
cd Scripts # Switch path entry Scripts In the folder
activate.bat # Activate the virtual environment
open pycharm -> settting -> project -> Python Interpreter
Click on Add Python Interpreter --> Virtualenv Environmeent
, Choose an existing environment
# When the virtual environment starts, shut down the virtual environment with the following instructions
deactivate